Skip to content

Numeric separated literals should disallow zero leading #39563

Closed
@MaxGraey

Description

@MaxGraey

Search Terms:
numeric separator

spec test for checking leading zero separated literal

Code

These literals should be invalid:

0_0
0_0.0
0_0e0_0
0_0_1

but this should valid:

1_0.0_1 // 10.01
1_0e0_1 // 100

Expected behavior:
SyntaxError: Numeric separator can not be used after leading 0.

Actual behavior:

0_0     // -> 0  valid but shouldn't
0_0.0   // -> 0  valid but shouldn't
0_0e0_0 // -> 0  valid but shouldn't
0_0_1   // -> 1  valid but shouldn't. Btw 001 is invalid in strict mode

1_0.0_1 // -> 10.01 ok
1_0e0_1 // -> 100 ok

playground

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions