[Bug]: TypeScript compilation throws error on correct program (type inference on array spread syntax?) #15380
Labels
area: typescript
i: bug
i: regression
outdated
A closed issue/PR that is archived due to age. Recommended to make a new issue
💻
How are you using Babel?
@babel/cli
Input code
This REPL session also showcases the issue.
Configuration file name
babel.config.json
Configuration
Current and expected behavior
Current behavior: compilation fails with the following log:
Moving the function definition for
mkList
to the top of the file fixes the issue. So does adding a type assertion on line 4:return [...(bar as typeof bar)];
.Setting targets to "defaults" in the config also fixes the issue.
Environment
Possible solution
No response
Additional context
This appears to be a regression between 7.17 and 7.18. See this REPL session, where I just changed the version to 7.17.
In the CLI, I can make the compilation succeed with the following package.json file for Yarn:
The text was updated successfully, but these errors were encountered: