fix(44249): JSX: "extract to constant" generates invalid code when using fragment syntax (#44252)

Fixes https://github.com/microsoft/TypeScript/issues/44249
This commit is contained in:
Oliver Joseph Ash
2021-05-26 21:24:02 +01:00
committed by GitHub
parent 459bd19941
commit 3e29397d74
2 changed files with 29 additions and 1 deletions

View File

@@ -2002,6 +2002,6 @@ namespace ts.refactor.extractSymbol {
}
function isInJSXContent(node: Node) {
return (isJsxElement(node) || isJsxSelfClosingElement(node) || isJsxFragment(node)) && isJsxElement(node.parent);
return (isJsxElement(node) || isJsxSelfClosingElement(node) || isJsxFragment(node)) && (isJsxElement(node.parent) || isJsxFragment(node.parent));
}
}