Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infer arguments types from interface #16944

Closed
patrick91 opened this issue Jul 5, 2017 · 2 comments
Closed

Infer arguments types from interface #16944

patrick91 opened this issue Jul 5, 2017 · 2 comments

Comments

@patrick91
Copy link

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?

@ikatyang
Copy link
Contributor

ikatyang commented Jul 5, 2017

Duplicate of #16590, see #1373 and #6118.

@patrick91
Copy link
Author

Thanks, sorry I didn't find that issue, I'll close this

@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants