Skip to content

Commit 55d4d7b

Browse files
committed
Simplify nested indexed access types
1 parent 667de4b commit 55d4d7b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/compiler/checker.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8881,7 +8881,9 @@ namespace ts {
88818881
return type.simplified === circularConstraintType ? type : type.simplified;
88828882
}
88838883
type.simplified = circularConstraintType;
8884-
const objectType = type.objectType;
8884+
// We recursively simplify the object type as it may in turn be an indexed access type. For example, with
8885+
// '{ [P in T]: { [Q in U]: number } }[T][U]' we want to first simplify the inner indexed access type.
8886+
const objectType = getSimplifiedType(type.objectType);
88858887
if (objectType.flags & TypeFlags.Intersection && isGenericObjectType(objectType)) {
88868888
// Given an indexed access type T[K], if T is an intersection containing one or more generic types and one or
88878889
// more object types with only a string index signature, e.g. '(U & V & { [x: string]: D })[K]', return a

0 commit comments

Comments
 (0)