mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Merge pull request #18077 from fwouts/regex-bug
Fix #18071: Printer failure when encountering RegularExpressionLiteral
This commit is contained in:
@@ -359,6 +359,7 @@ namespace ts {
|
||||
case SyntaxKind.TemplateTail:
|
||||
return "}" + escapeText(node.text, CharacterCodes.backtick) + "`";
|
||||
case SyntaxKind.NumericLiteral:
|
||||
case SyntaxKind.RegularExpressionLiteral:
|
||||
return node.text;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,9 @@ namespace ts {
|
||||
|
||||
// github #14948
|
||||
printsCorrectly("templateLiteral", {}, printer => printer.printFile(createSourceFile("source.ts", "let greeting = `Hi ${name}, how are you?`;", ScriptTarget.ES2017)));
|
||||
|
||||
// github #18071
|
||||
printsCorrectly("regularExpressionLiteral", {}, printer => printer.printFile(createSourceFile("source.ts", "let regex = /abc/;", ScriptTarget.ES2017)));
|
||||
});
|
||||
|
||||
describe("printBundle", () => {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
let regex = /abc/;
|
||||
Reference in New Issue
Block a user