mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
Remove extra checkDefined in visitEachChildOfJsxExpression (#52482)
This commit is contained in:
parent
ac24daad6d
commit
39a9ac84fd
@ -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
|
||||
|
||||
@ -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;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
function test() {
|
||||
return React.createElement(React.Fragment, null);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user