Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler/visitorPublic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1454,7 +1454,7 @@ const visitEachChildTable: VisitEachChildTable = {

[SyntaxKind.JsxExpression]: function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
return context.factory.updateJsxExpression(node,
Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)));
nodeVisitor(node.expression, visitor, isExpression));
},

// Clauses
Expand Down
26 changes: 26 additions & 0 deletions src/testRunner/unittests/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -669,5 +669,31 @@ const MyClass = class {
}).outputText;
});

testBaseline("jsxExpression", () => {
function doNothing(context: ts.TransformationContext) {
const visitor = (node: ts.Node): ts.Node => {
return ts.visitEachChild(node, visitor, context);
};
return (node: ts.SourceFile) => ts.visitNode(node, visitor, ts.isSourceFile);
}

return ts.transpileModule(`
function test () {
return <>
{/* This comment breaks the transformer */}
</>
}
`, {
transformers: {
before: [doNothing],
},
compilerOptions: {
jsx: ts.JsxEmit.React,
target: ScriptTarget.ES2015,
experimentalDecorators: true,
newLine: NewLineKind.CarriageReturnLineFeed,
}
}).outputText;
});
});

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function test() {
return React.createElement(React.Fragment, null);
}