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

Bug Repro: Unused PropTypes detects flow destructuring #977

Merged
merged 1 commit into from Dec 13, 2019

Conversation

@dozoisch
Copy link
Contributor

dozoisch commented Nov 25, 2016

Hello! I figured I would open a PR instead of an issue to be able to show the two failing test cases.

The first, should pass because notTarget is used. But it fails with 'target' PropType is defined but prop is never used. It seems like it takes the destructuring as the props instead of the props: Props. Note that this is fine if instead of destructuring { target } I do a simple argument like infos (added a test case to show).

type Props = {notTarget: string};
class Hello extends React.Component {
  props: Props;
  onEvent({ target }: { target: Object }) {};
  //   onEvent(infos: { target: Object }) {}; passes
  render () {
    return <div>Hello {this.props.notTarget}</div>;
  }
}

And on the invalid side, I added a similar test case with two props, one unused, but it fails on the wrong prop.


This change is Reviewable

@yannickcr yannickcr force-pushed the yannickcr:master branch from 5717b76 to 13806f1 Jan 7, 2017
@dozoisch dozoisch force-pushed the dozoisch:unused_flow_failing branch from b3fcad5 to 27e0487 Feb 13, 2017
@yannickcr yannickcr force-pushed the yannickcr:master branch from f4737f0 to 73abadb Aug 9, 2017
@yannickcr yannickcr force-pushed the yannickcr:master branch from c8dedeb to dc9f85e Sep 24, 2017
@yannickcr yannickcr force-pushed the yannickcr:master branch from dca5cd5 to c148893 Nov 18, 2017
@ljharb ljharb force-pushed the dozoisch:unused_flow_failing branch from 27e0487 to 8df4943 Dec 13, 2019
@ljharb
ljharb approved these changes Dec 13, 2019
Copy link
Collaborator

ljharb left a comment

I've rebased, and these tests appear to now be passing, so it must have been fixed in the interim!

@ljharb ljharb merged commit 8df4943 into yannickcr:master Dec 13, 2019
2 of 3 checks passed
2 of 3 checks passed
continuous-integration/travis-ci/push The Travis CI build is in progress
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage decreased (-0.0005%) to 97.514%
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.