镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
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

  1. ikatyang commented on Jul 5, 2017

    @ikatyang
    Contributor

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

  2. patrick91 commented on Jul 5, 2017

    @patrick91
    Author

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

  3. locked and limited conversation to collaborators on Jun 14, 2018
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