Fix inference to indexed access type containing substitution type
This commit is contained in:
parent
454b4280b1
commit
0759bc67a4
1 changed files with 8 additions and 3 deletions
|
@ -14860,6 +14860,14 @@ namespace ts {
|
|||
target = removeTypesFromUnionOrIntersection(<UnionOrIntersectionType>target, matchingTypes);
|
||||
}
|
||||
}
|
||||
else if (target.flags & TypeFlags.Substitution) {
|
||||
target = (target as SubstitutionType).typeVariable;
|
||||
}
|
||||
else if (target.flags & TypeFlags.IndexedAccess && (
|
||||
(<IndexedAccessType>target).objectType.flags & TypeFlags.Substitution ||
|
||||
(<IndexedAccessType>target).indexType.flags & TypeFlags.Substitution)) {
|
||||
target = getIndexedAccessType(getActualTypeVariable((<IndexedAccessType>target).objectType), getActualTypeVariable((<IndexedAccessType>target).indexType));
|
||||
}
|
||||
if (target.flags & TypeFlags.TypeVariable) {
|
||||
// If target is a type parameter, make an inference, unless the source type contains
|
||||
// the anyFunctionType (the wildcard type that's used to avoid contextually typing functions).
|
||||
|
@ -14921,9 +14929,6 @@ namespace ts {
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (target.flags & TypeFlags.Substitution) {
|
||||
inferFromTypes(source, (target as SubstitutionType).typeVariable);
|
||||
}
|
||||
if (getObjectFlags(source) & ObjectFlags.Reference && getObjectFlags(target) & ObjectFlags.Reference && (<TypeReference>source).target === (<TypeReference>target).target) {
|
||||
// If source and target are references to the same generic type, infer from type arguments
|
||||
const sourceTypes = (<TypeReference>source).typeArguments || emptyArray;
|
||||
|
|
Loading…
Reference in a new issue