Skip to content

Commit 01ee1b9

Browse files
committed
Exclude T[K] assignability check from definitelyAssignableRelation
1 parent 52a46c6 commit 01ee1b9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12254,7 +12254,8 @@ namespace ts {
1225412254
else if (target.flags & TypeFlags.IndexedAccess) {
1225512255
// A type S is related to a type T[K], where T and K aren't both type variables, if S is related to C,
1225612256
// where C is the base constraint of T[K]
12257-
if (relation !== identityRelation && !(isGenericObjectType((<IndexedAccessType>target).objectType) && isGenericIndexType((<IndexedAccessType>target).indexType))) {
12257+
if (relation !== identityRelation && relation !== definitelyAssignableRelation &&
12258+
!(isGenericObjectType((<IndexedAccessType>target).objectType) && isGenericIndexType((<IndexedAccessType>target).indexType))) {
1225812259
const constraint = getBaseConstraintOfType(target);
1225912260
if (constraint && constraint !== target) {
1226012261
if (result = isRelatedTo(source, constraint, reportErrors)) {

0 commit comments

Comments
 (0)