Skip to content

Conversation

@Andarist
Copy link
Contributor

fixes #58442

…ectly reported when relating to targets with multiple index signatures
@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Dec 29, 2024
? propType
: getTypeWithFacts(propType, TypeFacts.NEUndefined);
const related = isRelatedTo(type, targetInfo.type, RecursionFlags.Both, reportErrors, /*headMessage*/ undefined, intersectionState);
const related = isRelatedTo(type, targetInfo.type, RecursionFlags.Both, reportErrors, /*headMessage*/ undefined, intersectionState, targetInfo === getApplicableIndexInfo(target, propKeyType));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where the allowExtraPropertyChecks is toggled~ when relating to a targetInfo.type. The source is related to all target infos (that's what the indexSignaturesRelatedTo caller does). Those checks should only be performed when relating to the applicable index info to reflect what happens in assignments like:

obj.indexSignatureProp = { someProp: 'foo' }

In the example above, { someProp: string } is only related to the applicable index info "selected" by obj.indexSignatureProp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

Error in Index Signature Assignment

2 participants