diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 9306907b418..b1ac56d66eb 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8881,7 +8881,9 @@ namespace ts { return type.simplified === circularConstraintType ? type : type.simplified; } type.simplified = circularConstraintType; - const objectType = type.objectType; + // We recursively simplify the object type as it may in turn be an indexed access type. For example, with + // '{ [P in T]: { [Q in U]: number } }[T][U]' we want to first simplify the inner indexed access type. + const objectType = getSimplifiedType(type.objectType); if (objectType.flags & TypeFlags.Intersection && isGenericObjectType(objectType)) { // Given an indexed access type T[K], if T is an intersection containing one or more generic types and one or // more object types with only a string index signature, e.g. '(U & V & { [x: string]: D })[K]', return a