Skip to content
This repository was archived by the owner on Feb 14, 2023. It is now read-only.

Typescript: Incorrect types on class ComponentΒ #98

@ghost

Description

"react": "^16.8.1",
"reactn": "^2.1.4",

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedThe owner cannot resolve this on their own.more info neededThe issue requires more information.supportA user is requesting support.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions