TypeScript Version: 2.9.0-rc
Search Terms: type octal
Code
const a: '\1' = '1'; // 'a' is of type '1' and contains '1'
const b: '\1' = '\1'; // 'b' is of type '1', but contains '\u0001'
const c = '\1'; // same as 'b'
Expected behavior:
Octal escapes in string literals are handled correctly.
For LiteralTypeNodes I would probably prefer a grammar error, but type inference also needs to handle octal escapes.
Actual behavior:
Octal escapes are ignored when converting a StringLiteral to a LiteralType.
Playground Link: https://agentcooper.github.io/typescript-play/?target=5#code/MYewdgzgLgBAhgLhgcgDoEZkwLwswbhgHoiU4sBLCGEAMxigE8AHAUzyzjABMZQwocCpA4AoftBgAjJGkw4UGZIRIoplanQYt2yTABppAV1j9Bw6miMAGW5nHhJwBXOXFSEOAFt2cS+qA
Related Issues:
TypeScript Version: 2.9.0-rc
Search Terms: type octal
Code
Expected behavior:
Octal escapes in string literals are handled correctly.
For LiteralTypeNodes I would probably prefer a grammar error, but type inference also needs to handle octal escapes.
Actual behavior:
Octal escapes are ignored when converting a StringLiteral to a LiteralType.
Playground Link: https://agentcooper.github.io/typescript-play/?target=5#code/MYewdgzgLgBAhgLhgcgDoEZkwLwswbhgHoiU4sBLCGEAMxigE8AHAUzyzjABMZQwocCpA4AoftBgAjJGkw4UGZIRIoplanQYt2yTABppAV1j9Bw6miMAGW5nHhJwBXOXFSEOAFt2cS+qA
Related Issues: