Fake up value declaration for synthetic jsx children symbol so they get excess property checked (#29359)

This commit is contained in:
Wesley Wigham
2019-01-15 22:31:57 -08:00
committed by GitHub
parent 9cd5f2dd3c
commit 41a7bf4b73
7 changed files with 188 additions and 1 deletions

View File

@@ -18550,6 +18550,10 @@ namespace ts {
childrenPropSymbol.type = childrenTypes.length === 1 ?
childrenTypes[0] :
(getArrayLiteralTupleTypeIfApplicable(childrenTypes, childrenContextualType, /*hasRestElement*/ false) || createArrayType(getUnionType(childrenTypes)));
// Fake up a property declaration for the children
childrenPropSymbol.valueDeclaration = createPropertySignature(/*modifiers*/ undefined, unescapeLeadingUnderscores(jsxChildrenPropertyName), /*questionToken*/ undefined, /*type*/ undefined, /*initializer*/ undefined);
childrenPropSymbol.valueDeclaration.parent = attributes;
childrenPropSymbol.valueDeclaration.symbol = childrenPropSymbol;
const childPropMap = createSymbolTable();
childPropMap.set(jsxChildrenPropertyName, childrenPropSymbol);
spread = getSpreadType(spread, createAnonymousType(attributes.symbol, childPropMap, emptyArray, emptyArray, /*stringIndexInfo*/ undefined, /*numberIndexInfo*/ undefined),