babel / babylon

PSA: moved into babel/babel as @babel/parser -->

Home Page:https://github.com/babel/babel/tree/master/packages/babel-parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error w/ generics in return type annots inside JSXExpressionContainers

mroch opened this issue · comments

Input Code

<bar>{function(): string {}}</bar>; // parses
<bar>{function(): Array<string> {}}</bar>; // errors

Babylon/Babel Configuration

jsx, flow

Expected Behavior

Flow parses this as a JSXExpressionStatement containing a FunctionExpression containing a GenericTypeAnnotation returnType.

Current Behavior

Babylon gets into some sort of bad state and errors about unexpected tokens.

Your Environment

software version
Babylon 7.0.0-beta.12
node astexplorer
npm n/a
Operating System Mac

This may be the same as #36. The repro in that issue doesn't seem to work anymore, but there's a test so I'm surprised. Decided to open a new issue since that one is old and closed but happy to move discussion back there.

commented

Hey @mroch! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.

That fix was released in beta.14. Can you try using a more recent version?

ah ok. my bad, thanks!