- Error
- Reported by the lexer and parser
TS1125
Hexadecimal digit expected.
A hexadecimal number or escape has no hex digits where they are required, as in `0x` alone. Add the digits.
What it means
Hexadecimal literals (0x...) and escapes such as \x.. and \u.... need hexadecimal digits (0-9, a-f, A-F). This is reported when none or too few follow.
Example
const n = 0x;
export {};
ts-r-check -p tsconfig.json --pretty false ts-r outputindex.ts(1,13): error TS1125: Hexadecimal digit expected.
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
- Write the digits:
0xff. - In strings, a
\uescape needs exactly four hex digits, or braces:\u{1F600}.