Skip to content

Commit d0f3303

Browse files
committed
Explore additional constraint
1 parent 8223920 commit d0f3303

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/compiler/checker.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19229,6 +19229,17 @@ namespace ts {
1922919229
resetErrorInfo(saveErrorInfo);
1923019230
return result;
1923119231
}
19232+
if (isMappedTypeGenericIndexedAccess(source)) {
19233+
// For an indexed access type { [P in K]: E}[X], above we have already explored an instantiation of E with X
19234+
// substituted for P. We also want to explore type { [P in K]: E }[C], where C is the constraint of X.
19235+
const indexConstraint = getConstraintOfType((source as IndexedAccessType).indexType);
19236+
if (indexConstraint) {
19237+
if (result = isRelatedTo(getIndexedAccessType((source as IndexedAccessType).objectType, indexConstraint), target, RecursionFlags.Source, reportErrors)) {
19238+
resetErrorInfo(saveErrorInfo);
19239+
return result;
19240+
}
19241+
}
19242+
}
1923219243
}
1923319244
}
1923419245
else if (source.flags & TypeFlags.Index) {

0 commit comments

Comments
 (0)