-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
octal escapes are not handled correctly in string literal types #24209
Comments
It seems like this is not specific to literal types. This is caused by incorrect parsing of octal escape sequences in every StringLiteral. |
Duplicate of #396. |
#396 is about making octal escape sequences an error. Only #396 (comment) mentions some difficulties with the scanner / parser. However, I'm ok with closing this as duplicate. I hope nobody uses octal escape sequences anymore so the type checking inconsistencies are not a problem in real world code. |
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed. |
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:
The text was updated successfully, but these errors were encountered: