Skip to content

TypeScript: Support numeric separators #7329

Closed

Description

@ulrichb

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

Activity

  1. changed the title [-]Numeric separators not supported in TypeScript[/-] [+]Numeric separators not supported in TS files[/+] on Jul 5, 2019
  2. added this to the 3.1 milestone on Jul 5, 2019
  3. changed the title [-]Numeric separators not supported in TS files[/-] [+]TypeScript: Support numeric separators[/+] on Jul 5, 2019
  4. tharun208 commented on Oct 16, 2019

    @tharun208
    Contributor

    Added fix in this pull Request #7817

  5. locked and limited conversation to collaborators on Nov 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions