Skip to content

Commit 49e1961

Browse files
committed
Move case to prefered location
1 parent 93afc10 commit 49e1961

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/compiler/checker.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11401,23 +11401,6 @@ namespace ts {
1140111401
}
1140211402
return;
1140311403
}
11404-
else if (target.flags & TypeFlags.IndexedAccess) {
11405-
const targetConstraint = (<IndexedAccessType>target).objectType;
11406-
const inference = getInferenceInfoForType(targetConstraint);
11407-
if (inference) {
11408-
if (!inference.isFixed) {
11409-
// Instantiates instance of `type PartialInference<T, Keys extends string> = ({[K in Keys]: {[K1 in K]: T}})[Keys];`
11410-
// Where `T` is `source` and `Keys` is `target.indexType`
11411-
const inferenceTypeSymbol = getGlobalSymbol("PartialInference" as __String, SymbolFlags.Type, Diagnostics.Cannot_find_global_type_0);
11412-
const inferenceType = getDeclaredTypeOfSymbol(inferenceTypeSymbol);
11413-
if (inferenceType !== unknownType) {
11414-
const mapper = createTypeMapper(getSymbolLinks(inferenceTypeSymbol).typeParameters, [source, (target as IndexedAccessType).indexType]);
11415-
(inference.indexes || (inference.indexes = [])).push(instantiateType(inferenceType, mapper));
11416-
}
11417-
}
11418-
return;
11419-
}
11420-
}
1142111404
}
1142211405
if (getObjectFlags(source) & ObjectFlags.Reference && getObjectFlags(target) & ObjectFlags.Reference && (<TypeReference>source).target === (<TypeReference>target).target) {
1142311406
// If source and target are references to the same generic type, infer from type arguments
@@ -11449,6 +11432,23 @@ namespace ts {
1144911432
inferFromTypes((<IndexedAccessType>source).objectType, (<IndexedAccessType>target).objectType);
1145011433
inferFromTypes((<IndexedAccessType>source).indexType, (<IndexedAccessType>target).indexType);
1145111434
}
11435+
else if (target.flags & TypeFlags.IndexedAccess) {
11436+
const targetConstraint = (<IndexedAccessType>target).objectType;
11437+
const inference = getInferenceInfoForType(targetConstraint);
11438+
if (inference) {
11439+
if (!inference.isFixed) {
11440+
// Instantiates instance of `type PartialInference<T, Keys extends string> = ({[K in Keys]: {[K1 in K]: T}})[Keys];`
11441+
// Where `T` is `source` and `Keys` is `target.indexType`
11442+
const inferenceTypeSymbol = getGlobalSymbol("PartialInference" as __String, SymbolFlags.Type, Diagnostics.Cannot_find_global_type_0);
11443+
const inferenceType = getDeclaredTypeOfSymbol(inferenceTypeSymbol);
11444+
if (inferenceType !== unknownType) {
11445+
const mapper = createTypeMapper(getSymbolLinks(inferenceTypeSymbol).typeParameters, [source, (target as IndexedAccessType).indexType]);
11446+
(inference.indexes || (inference.indexes = [])).push(instantiateType(inferenceType, mapper));
11447+
}
11448+
}
11449+
return;
11450+
}
11451+
}
1145211452
else if (target.flags & TypeFlags.UnionOrIntersection) {
1145311453
const targetTypes = (<UnionOrIntersectionType>target).types;
1145411454
let typeVariableCount = 0;

0 commit comments

Comments
 (0)