mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-19 11:42:41 -05:00
Fix tagged templates that consist of a single part
Example: foo `bar` should compile to foo([“bar”])
This commit is contained in:
@@ -2048,7 +2048,12 @@ module ts {
|
||||
}
|
||||
|
||||
function getTemplateLiteralAsStringLiteral(node: LiteralExpression): string {
|
||||
return '"' + escapeString(node.text) + '"';
|
||||
if (node.parent.kind === SyntaxKind.TaggedTemplateExpression) {
|
||||
// Emit tagged template as foo(["string"])
|
||||
return '["' + escapeString(node.text) + '"]';
|
||||
} else {
|
||||
return '"' + escapeString(node.text) + '"';
|
||||
}
|
||||
}
|
||||
|
||||
function emitTemplateExpression(node: TemplateExpression): void {
|
||||
|
||||
Reference in New Issue
Block a user