Skip to content

Commit c68d37a

Browse files
committed
Small refinement
1 parent 5bf01b3 commit c68d37a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/compiler/checker.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -9262,11 +9262,12 @@ namespace ts {
92629262
// We recursively simplify the object type as it may in turn be an indexed access type. For example, with
92639263
// '{ [P in T]: { [Q in U]: number } }[T][U]' we want to first simplify the inner indexed access type.
92649264
const objectType = getSimplifiedType(type.objectType);
9265+
const indexType = getSimplifiedType(type.indexType);
92659266
if (objectType.flags & TypeFlags.Union) {
9266-
return type.simplified = mapType(objectType, t => getIndexedAccessType(t, type.indexType));
9267+
return type.simplified = mapType(objectType, t => getSimplifiedType(getIndexedAccessType(t, indexType)));
92679268
}
92689269
if (objectType.flags & TypeFlags.Intersection) {
9269-
return type.simplified = getIntersectionType(map((objectType as IntersectionType).types, t => getIndexedAccessType(t, type.indexType)));
9270+
return type.simplified = getIntersectionType(map((objectType as IntersectionType).types, t => getSimplifiedType(getIndexedAccessType(t, indexType))));
92709271
}
92719272
// If the object type is a mapped type { [P in K]: E }, where K is generic, instantiate E using a mapper
92729273
// that substitutes the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we

0 commit comments

Comments
 (0)