-
Notifications
You must be signed in to change notification settings - Fork 143
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
Failure to parse some usages of Flow $Call (Unexpected token, expected ",") #758
Comments
Thanks for reporting! I think the bug here is that |
Fixes #758 There was already some logic from #716 to handle cases like `f<<T>() => void>`, where we're transitioning from a non-type context to a type context and need to detect if `<<` is actually two open-type-parameter/argument tokens. There was a simpler missing case, though, which is that `<<` is never allowed within a type, so we should exit early with a simple `<` in a type context. There was already a similar case for `>`, so this just uses the same logic for `<`. This fixes the same issue in TS and Flow.
Fixes #758 There was already some logic from #716 to handle cases like `f<<T>() => void>`, where we're transitioning from a non-type context to a type context and need to detect if `<<` is actually two open-type-parameter/argument tokens. There was a simpler missing case, though, which is that `<<` is never allowed within a type, so we should tokenize as a simple `<` in a type context. To handle the various cases correctly, this extra logic needs to only happen for `<<`, and this PR also adds some additional comments explaining the nuances.
Thxx a lot ! :) |
Sucrase fails to parse some usages of the type helper
$Call
inside Flow code :Example of code failing :
Demo :
The text was updated successfully, but these errors were encountered: