Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

typeof React.Component stopped working #18946

Copy link
Copy link
@mikew

Description

@mikew
Issue body actions

TypeScript Version: 2.5.3

Code

class MyComponent extends React.Component<{}, {}> {
  render () {
    return null
  }
}

function thisTakesAComponent (component: typeof React.Component) {

}

thisTakesAComponent(MyComponent)

Expected behavior:
Should compile fine.

Actual behavior:

Argument of type 'typeof MyComponent' is not assignable to parameter of type 'typeof Component'.
  Type 'MyComponent' is not assignable to type 'Component<P, S>'.
    Types of property 'setState' are incompatible.
      Type '{ <K extends never>(f: (prevState: {}, props: {}) => Pick<{}, K>, callback?: (() => any) | undefi...' is not assignable to type '{ <K extends keyof S>(f: (prevState: S, props: P) => Pick<S, K>, callback?: (() => any) | undefin...'.
        Types of parameters 'f' and 'f' are incompatible.
          Types of parameters 'prevState' and 'prevState' are incompatible.
            Type '{}' is not assignable to type 'S'.
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.