From 01ee1b9c25ca8201bfae39aa288357e1c9ec91a4 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 28 Nov 2018 14:56:49 -0800 Subject: [PATCH] Exclude T[K] assignability check from definitelyAssignableRelation --- src/compiler/checker.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7a1364c7a1f..bc3bd0ebd8a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -12254,7 +12254,8 @@ namespace ts { else if (target.flags & TypeFlags.IndexedAccess) { // 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, // where C is the base constraint of T[K] - if (relation !== identityRelation && !(isGenericObjectType((target).objectType) && isGenericIndexType((target).indexType))) { + if (relation !== identityRelation && relation !== definitelyAssignableRelation && + !(isGenericObjectType((target).objectType) && isGenericIndexType((target).indexType))) { const constraint = getBaseConstraintOfType(target); if (constraint && constraint !== target) { if (result = isRelatedTo(source, constraint, reportErrors)) {