Skip to content

Conversation

@a-tarasyuk
Copy link
Contributor

Fixes #2356

Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took me a bit to figure out what the Strada code did but, yeah:

        const flags = (neverAsciiEscape ? GetLiteralTextFlags.NeverAsciiEscape : 0)
            | (jsxAttributeEscape ? GetLiteralTextFlags.JsxAttributeEscape : 0)
            | (printerOptions.terminateUnterminatedLiterals ? GetLiteralTextFlags.TerminateUnterminatedLiterals : 0)
            | (printerOptions.target && printerOptions.target >= ScriptTarget.ES2021 ? GetLiteralTextFlags.AllowNumericSeparator : 0);

        return getLiteralText(node, sourceFile, flags);

Unbelievably, this is the only reason we pass the target into the printer.

(I do bet we have other things that are missing, though.)

Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Er, actually, no, getLiteralTextOfNode is where this should live, which is where I pulled the above code from. There is a TODO there for this (and related code).

@jakebailey jakebailey added this pull request to the merge queue Dec 12, 2025
Merged via the queue into microsoft:main with commit 9321c22 Dec 12, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Omit numeric separators when targeting es2020

3 participants