Fix 10625: JSX Not validating when index signature is present (#10352)

* Check for type of property declaration before using index signature

* Add tests and baselines

* fix linting error
This commit is contained in:
Yui
2016-08-16 08:47:21 -07:00
committed by GitHub
parent 80c04f8e97
commit f7f50073d3
4 changed files with 120 additions and 4 deletions

View File

@@ -10140,10 +10140,9 @@ namespace ts {
const correspondingPropSymbol = getPropertyOfType(elementAttributesType, node.name.text);
correspondingPropType = correspondingPropSymbol && getTypeOfSymbol(correspondingPropSymbol);
if (isUnhyphenatedJsxName(node.name.text)) {
// Maybe there's a string indexer?
const indexerType = getIndexTypeOfType(elementAttributesType, IndexKind.String);
if (indexerType) {
correspondingPropType = indexerType;
const attributeType = getTypeOfPropertyOfType(elementAttributesType, getTextOfPropertyName(node.name)) || getIndexTypeOfType(elementAttributesType, IndexKind.String);
if (attributeType) {
correspondingPropType = attributeType;
}
else {
// If there's no corresponding property with this name, error