Fix/jsx syntax quickinfo (#42124)

* feat: add jsx type invalid check

* feat: update jsxGenericQuickInfo test cases
This commit is contained in:
chenjigeng
2020-12-29 01:43:43 +08:00
committed by GitHub
parent fe297df9df
commit ea03c2966b
2 changed files with 24 additions and 12 deletions

View File

@@ -2695,7 +2695,7 @@ namespace ts {
return symbol ? [symbol] : emptyArray;
}
const discriminatedPropertySymbols = mapDefined(contextualType.types, t => isObjectLiteralExpression(node.parent) && checker.isTypeInvalidDueToUnionDiscriminant(t, node.parent) ? undefined : t.getProperty(name));
const discriminatedPropertySymbols = mapDefined(contextualType.types, t => (isObjectLiteralExpression(node.parent)|| isJsxAttributes(node.parent)) && checker.isTypeInvalidDueToUnionDiscriminant(t, node.parent) ? undefined : t.getProperty(name));
if (unionSymbolOk && (discriminatedPropertySymbols.length === 0 || discriminatedPropertySymbols.length === contextualType.types.length)) {
const symbol = contextualType.getProperty(name);
if (symbol) return [symbol];