You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 14, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 14, 2023. It is now read-only.
Typescript: Incorrect types on class Component #98
When using reactn as: import React, { Component } from 'reactn'
TypeScript fails with the following:
Class static side 'typeof Form' incorrectly extends base class static side '{ propTypes?: WeakValidationMap<{}> | undefined; contextType?: Context<any> | undefined; contextTypes?: ValidationMap<any> | undefined; childContextTypes?: ValidationMap<any> | undefined; defaultProps?: Partial<...> | undefined; displayName?: string | undefined; getDerivedStateFromProps?: GetDerivedStateFromProps<.....'.
Type 'typeof Form' is not assignable to type '{ propTypes?: WeakValidationMap<{}> | undefined; contextType?: Context<any> | undefined; contextTypes?: ValidationMap<any> | undefined; childContextTypes?: ValidationMap<any> | undefined; defaultProps?: Partial<...> | undefined; displayName?: string | undefined; getDerivedStateFromProps?: GetDerivedStateFromProps<.....'.
Types of property 'getDerivedStateFromProps' are incompatible.
Type '(nextProps: Props, prevState: State) => { prevPath: string; } | null' is not assignable to type 'GetDerivedStateFromProps<{}, {}>'.
Types of parameters 'nextProps' and 'nextProps' are incompatible.
Type 'Readonly<{}>' is not assignable to type 'Props'.
Type 'Readonly<{}>' is missing the following properties from type 'RouteComponentProps<RouteParams, StaticContext, any>': history, location, match TS2417
54 | }
55 |
> 56 | class Form extends Component<Props, State> {
| ^
57 | constructor(props: Props) {
58 | super(props)
59 |
@CharlesStover, do you have any idea why? Any help would be appreciated
Activity
quisido commentedon Jun 24, 2019
Thanks for reporting this. Does your
Formclass have agetDerivedStateFromPropsstatic method?quisido commentedon Jun 25, 2019
What version of TypeScript are you using? You can find them via
npm ls typescript.