You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Produces code that prints a null character followed by 1.
Actual behavior:
Produces this code:
"use strict";console.log("\01");
This crashes because \01 is an octal literal, which isn't allowed in strict mode.
Note that this TypeScript code fails in a similar way:
console.log(`\u00001`);
Context:
This came up when converting the decaffeinate test suite to TypeScript, and the test case was based on a test from the CoffeeScript test suite. The CoffeeScript test suite has lots of edge cases like this, so I don't necessarily think this bug is likely to come up in real production code, but still would be good to fix. I was able to work around the issue (diff), so it's not blocking me, but CoffeeScript and Babel handle this sort of thing, so would be good if TypeScript did as well.
The text was updated successfully, but these errors were encountered:
TypeScript Version: 2.4.1
Code
Playground link
Expected behavior:
Produces code that prints a null character followed by 1.
Actual behavior:
Produces this code:
This crashes because
\01
is an octal literal, which isn't allowed in strict mode.Note that this TypeScript code fails in a similar way:
Context:
This came up when converting the decaffeinate test suite to TypeScript, and the test case was based on a test from the CoffeeScript test suite. The CoffeeScript test suite has lots of edge cases like this, so I don't necessarily think this bug is likely to come up in real production code, but still would be good to fix. I was able to work around the issue (diff), so it's not blocking me, but CoffeeScript and Babel handle this sort of thing, so would be good if TypeScript did as well.
The text was updated successfully, but these errors were encountered: