diff --git a/src/compiler/printer.ts b/src/compiler/printer.ts index ccdd07d6610..59e1319f5a6 100644 --- a/src/compiler/printer.ts +++ b/src/compiler/printer.ts @@ -528,12 +528,16 @@ const _super = (function (geti, seti) { // JSX (non-expression) case SyntaxKind.JsxText: return emitJsxText(node); + case SyntaxKind.JsxOpeningElement: + return emitJsxOpeningElement(node); case SyntaxKind.JsxClosingElement: return emitJsxClosingElement(node); case SyntaxKind.JsxAttribute: return emitJsxAttribute(node); case SyntaxKind.JsxSpreadAttribute: return emitJsxSpreadAttribute(node); + case SyntaxKind.JsxExpression: + return emitJsxExpression(node); // Clauses case SyntaxKind.CaseClause: @@ -652,10 +656,6 @@ const _super = (function (geti, seti) { return emitJsxElement(node); case SyntaxKind.JsxSelfClosingElement: return emitJsxSelfClosingElement(node); - case SyntaxKind.JsxOpeningElement: - return emitJsxOpeningElement(node); - case SyntaxKind.JsxExpression: - return emitJsxExpression(node); // Transformation nodes case SyntaxKind.PartiallyEmittedExpression: diff --git a/src/compiler/transformers/jsx.ts b/src/compiler/transformers/jsx.ts index 6d90415b5e5..9fd2eb0ebb1 100644 --- a/src/compiler/transformers/jsx.ts +++ b/src/compiler/transformers/jsx.ts @@ -234,10 +234,10 @@ namespace ts { function getAttributeName(node: JsxAttribute): StringLiteral | Identifier { const name = node.name; if (/^[A-Za-z_]\w*$/.test(name.text)) { - return createLiteral(name.text); + return name; } else { - return name; + return createLiteral(name.text); } }