• Error
  • Reported by the lexer and parser

TS6188

Numeric separators are not allowed here.

A numeric separator `_` is in a place where it isn't allowed, such as at the end of a number or next to a decimal point.

What it means

Numeric separators (1_000_000) may only appear between two digits. One at the end of a literal, right after 0x, next to . or next to the exponent e is a syntax error, reported by ts-r's lexer.

Example

index.ts
export const big = 1_000_;
ts-r-check -p tsconfig.json --pretty false ts-r output
index.ts(1,25): error TS6188: Numeric separators are not allowed here.

Recorded by node scripts/verify-examples.mjs with ts-r built from commit 6deaf01. The example uses the default tsconfig: strict, target: es2022, module: esnext, moduleResolution: bundler.

How to fix

  • Remove the separator or move it between two digits: 1_000.