Skip to content
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

TypeScript: Support numeric separators #7329

Closed
ulrichb opened this issue Jul 5, 2019 · 1 comment · Fixed by #7817
Closed

TypeScript: Support numeric separators #7329

ulrichb opened this issue Jul 5, 2019 · 1 comment · Fixed by #7817
Milestone

Comments

@ulrichb
Copy link

ulrichb commented Jul 5, 2019

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.)

@ulrichb ulrichb changed the title Numeric separators not supported in TypeScript Numeric separators not supported in TS files Jul 5, 2019
@bugzpodder bugzpodder added this to the 3.1 milestone Jul 5, 2019
@ulrichb ulrichb changed the title Numeric separators not supported in TS files TypeScript: Support numeric separators Jul 5, 2019
@tharun208
Copy link
Contributor

tharun208 commented Oct 16, 2019

Added fix in this pull Request #7817

@lock lock bot locked and limited conversation to collaborators Nov 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants