diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 75f8715fca7..4e1d71c3d7a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10482,11 +10482,14 @@ namespace ts { } } // A type S is assignable to keyof T if S is assignable to keyof C, where C is the - // constraint of T. - const constraint = getConstraintForRelation((target).type); - if (constraint) { - if (result = isRelatedTo(source, getIndexType(constraint, (target as IndexType).stringsOnly), reportErrors)) { - return result; + // simplified form of T or, if T doesn't simplify, the constraint of T. + if (relation !== definitelyAssignableRelation) { + const simplified = getSimplifiedType((target).type); + const constraint = simplified !== (target).type ? simplified : getConstraintOfType((target).type); + if (constraint) { + if (result = isRelatedTo(source, getIndexType(constraint, (target as IndexType).stringsOnly), reportErrors)) { + return result; + } } } }