We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The title is a bit of a mouthful, but what I mean is this:
// @flow const foo = (): Foo<number => number> => {}
fails to parse with error
sucrase src -d dist -t flow $ node_modules/.bin/sucrase src -d dist -t flow src/index.js -> dist/index.js SyntaxError: Error transforming src/index.js: Unexpected token, expected ";" (2:15) at unexpected (node_modules/sucrase/dist/parser/traverser/util.js:83:15) at semicolon (node_modules/sucrase/dist/parser/traverser/util.js:61:5) at parseVarStatement (node_modules/sucrase/dist/parser/traverser/statement.js:454:19) at parseStatementContent (node_modules/sucrase/dist/parser/traverser/statement.js:171:7) at parseStatement (node_modules/sucrase/dist/parser/traverser/statement.js:109:3) at parseBlockBody (node_modules/sucrase/dist/parser/traverser/statement.js:504:5) at parseTopLevel (node_modules/sucrase/dist/parser/traverser/statement.js:85:3) at parseFile (node_modules/sucrase/dist/parser/traverser/index.js:17:35) at parse (node_modules/sucrase/dist/parser/index.js:26:35) at getSucraseContext (node_modules/sucrase/dist/index.js:88:30) { pos: 23, loc: Loc { line: 2, column: 15 }
The error only reproduces when
number => number
(x: number) => number
Foo<number => number>
Promise<number => number>
The following similar code examples parse just fine:
// @flow type X = Foo<number => number> const foo1 = (): X => {} const foo2 = (): Foo<(x:number) => number> => {} const foo3 = (): (number => number) => {} function foo4(): Foo<number => number> {}
Although without parenthesis around the return type, the third example actually produces invalid output, but that's probably a separate issue.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The title is a bit of a mouthful, but what I mean is this:
fails to parse with error
The error only reproduces when
number => number
does not have a name, i.e. not(x: number) => number
. This syntax is allowed in FlowFoo<number => number>
orPromise<number => number>
The following similar code examples parse just fine:
Although without parenthesis around the return type, the third example actually produces invalid output, but that's probably a separate issue.
The text was updated successfully, but these errors were encountered: