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
Parse arrows with params annotations in conditional expressions #10669
Parse arrows with params annotations in conditional expressions #10669
Conversation
nicolo-ribaudo
commented
Nov 6, 2019
Q | A |
---|---|
Fixed Issues? | Fixes #10651 |
Patch: Bug Fix? | Yes |
Major: Breaking Change? | |
Minor: New Feature? | |
Tests Added + Pass? | Yes |
Documentation PR Link | |
Any Dependency Changes? | |
License | MIT |
@@ -0,0 +1,2 @@ | |||
test | |||
? (x: T): U => y |
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.
U => y
must be parenthesized, otherwise flow could not parse it.
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.
It is a known bug with flow, because it also rejects this valid JS code:
test ? (x) : I => y
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.
For context, here is one of my first PRs 😛
babel/babylon#573