Preserve separators in numeric literals with target=ES2021+ (#57144)

This commit is contained in:
Dan Vanderkam
2024-02-15 17:26:42 -05:00
committed by GitHub
parent da5f0fe9d4
commit f41a5f5986
11 changed files with 198 additions and 1 deletions

View File

@@ -5657,7 +5657,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
const flags = (neverAsciiEscape ? GetLiteralTextFlags.NeverAsciiEscape : 0)
| (jsxAttributeEscape ? GetLiteralTextFlags.JsxAttributeEscape : 0)
| (printerOptions.terminateUnterminatedLiterals ? GetLiteralTextFlags.TerminateUnterminatedLiterals : 0)
| (printerOptions.target && printerOptions.target === ScriptTarget.ESNext ? GetLiteralTextFlags.AllowNumericSeparator : 0);
| (printerOptions.target && printerOptions.target >= ScriptTarget.ES2021 ? GetLiteralTextFlags.AllowNumericSeparator : 0);
return getLiteralText(node, currentSourceFile, flags);
}