@@ -10318,8 +10318,16 @@ namespace ts {
1031810318 return links.resolvedType;
1031910319 }
1032010320
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;
1032310331 }
1032410332
1032510333 /**
@@ -14860,13 +14868,8 @@ namespace ts {
1486014868 target = removeTypesFromUnionOrIntersection(<UnionOrIntersectionType>target, matchingTypes);
1486114869 }
1486214870 }
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);
1487014873 }
1487114874 if (target.flags & TypeFlags.TypeVariable) {
1487214875 // If target is a type parameter, make an inference, unless the source type contains
0 commit comments