mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
Simplify nested indexed access types
This commit is contained in:
parent
667de4bbb9
commit
55d4d7b5c6
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user