@@ -10318,8 +10318,16 @@ namespace ts {
10318
10318
return links.resolvedType;
10319
10319
}
10320
10320
10321
- function getActualTypeVariable(type: Type) {
10322
- return type.flags & TypeFlags.Substitution ? (<SubstitutionType>type).typeVariable : type;
10321
+ function getActualTypeVariable(type: Type): Type {
10322
+ if (type.flags & TypeFlags.Substitution) {
10323
+ return (<SubstitutionType>type).typeVariable;
10324
+ }
10325
+ if (type.flags & TypeFlags.IndexedAccess && (
10326
+ (<IndexedAccessType>type).objectType.flags & TypeFlags.Substitution ||
10327
+ (<IndexedAccessType>type).indexType.flags & TypeFlags.Substitution)) {
10328
+ return getIndexedAccessType(getActualTypeVariable((<IndexedAccessType>type).objectType), getActualTypeVariable((<IndexedAccessType>type).indexType));
10329
+ }
10330
+ return type;
10323
10331
}
10324
10332
10325
10333
/**
@@ -14860,13 +14868,8 @@ namespace ts {
14860
14868
target = removeTypesFromUnionOrIntersection(<UnionOrIntersectionType>target, matchingTypes);
14861
14869
}
14862
14870
}
14863
- else if (target.flags & TypeFlags.Substitution) {
14864
- target = (target as SubstitutionType).typeVariable;
14865
- }
14866
- else if (target.flags & TypeFlags.IndexedAccess && (
14867
- (<IndexedAccessType>target).objectType.flags & TypeFlags.Substitution ||
14868
- (<IndexedAccessType>target).indexType.flags & TypeFlags.Substitution)) {
14869
- target = getIndexedAccessType(getActualTypeVariable((<IndexedAccessType>target).objectType), getActualTypeVariable((<IndexedAccessType>target).indexType));
14871
+ else if (target.flags & (TypeFlags.IndexedAccess | TypeFlags.Substitution)) {
14872
+ target = getActualTypeVariable(target);
14870
14873
}
14871
14874
if (target.flags & TypeFlags.TypeVariable) {
14872
14875
// If target is a type parameter, make an inference, unless the source type contains
0 commit comments