mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-26 20:14:05 -05:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user