Skip to content

Infer arguments types from interface #16944

Description

I've tried to look for this issues, but I didn't find any.
Here's an example of the problem:

interface IComponentLifecycle<P> {
  componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
}

interface IProps {
  hello: string;
}

class X implements IComponentLifecycle<IProps> {
  componentWillReceiveProps(nextProps) { // <-- nextProps is any
    // TODO: logic
  }
}

This is based on react's typings (that's how I found the issue).

Is this an expected behaviour or not?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions