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
Fix crash when using Unions in flow propTypes #1563
Fix crash when using Unions in flow propTypes #1563
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This seems to work, but it would be nice to also have some test with some imported type that is used with union, like the main one reported from the issue. WDYT?
|
@jseminck that's a great idea :-) more tests is always better! |
Absolutely agree! I’ll send an MR with another test with an import in the morning. |
Thanks, a PR would be great (not sure what an MR is) |
Sorry @ljharb , been spending too much time using GitLab (merge request versus pull request). |
This will fix the crash when using Union flowtypes for the following rules:
prop-types
no-unused-prop-types
The library already escapes early when facing a
typeNode
it doesn't recognize; this will escape early when we can't even figure out thetypeNode
becauseUnionTypeAnnotation
s don't have anannotation.id
.This will not actually resolve the issue of using unions; it will simply prevent eslint from crashing.
Fixes issue #1468