-
-
Notifications
You must be signed in to change notification settings - Fork 27k
Closed
Labels
Milestone
Description
Describe the bug
Numeric separators (e.g. 10_000_000
) are supported in TypeScript since version 2.7. It's still an ES (stage 3) proposal, therefore it doesn't get transpiled by Babel. So you get errors like the following.
./src/FrontEnd/App.tsx
SyntaxError: ....\App.tsx: Identifier directly after number (17:14)
15 | import { reduxStore } from "./ReduxStore";
16 |
> 17 | console.log(10_000_000);
Steps to reproduce
See above.
Expected behavior
No transpile error.
Actual behavior
See above.
Reproducible demo
In any .ts/.tsx file:
console.log(10_000_000);
Solution
Add the "@babel/plugin-proposal-numeric-separator" plugin to the Babel preset if TypeScript is enabled. (Just like we do it for decorators.)
miraage, mc-suchecki, shirakaba, davl3232, bpallares and 1 more