@@ -18399,8 +18399,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
18399
18399
function createBackreferenceMapper(context: InferenceContext, inference: InferenceInfo): TypeMapper {
18400
18400
const inferences = context.inferences.indexOf(inference) >= 0 ? context.inferences : context.freeTypeVariables;
18401
18401
Debug.assert(inferences, "Inference for backreference mapper must exist within provided context");
18402
- const index = inferences! .indexOf(inference);
18403
- const forwardInferences = inferences! .slice(index);
18402
+ const index = inferences.indexOf(inference);
18403
+ const forwardInferences = inferences.slice(index);
18404
18404
return createTypeMapper(map(forwardInferences, i => i.typeParameter), map(forwardInferences, () => unknownType));
18405
18405
}
18406
18406
@@ -24096,7 +24096,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
24096
24096
const group = forkInferenceContext();
24097
24097
spawnAlternativeInferenceContext(group, () => {
24098
24098
if (length(context.freeTypeVariables)) {
24099
- inferFromTypes(originalSource, instantiateType(originalTarget, context.nonFixingMapper))
24099
+ inferFromTypes(originalSource, instantiateType(originalTarget, context.nonFixingMapper));
24100
24100
}
24101
24101
}, /*fork*/ false);
24102
24102
joinInferenceContext(group);
@@ -24801,7 +24801,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
24801
24801
/**
24802
24802
* Performs the given action in every alternative inference context currently under consideration,
24803
24803
* and add the resulting context(s) to a new resultant context list.
24804
- *
24804
+ *
24805
24805
* Call multiple times to create multiple independent forks of the existing inference engine state.
24806
24806
* Call once with fork `false` to simply to do and action for every existing branch of the inference
24807
24807
* engine state, while handling if those actions produce further forks of the state.
@@ -24880,7 +24880,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
24880
24880
if (useOnlyCachedAlternativeRoutes && !context.freeTypeVariableSourceSignatures?.get(last(sourceStack))?.get(sourceSignatures[i])) {
24881
24881
continue; // Doing a follow-up pass - ignore new alternatives that don't follow the same "route" as the first pass
24882
24882
}
24883
- spawnAlternativeInferenceContext(group, () =>
24883
+ spawnAlternativeInferenceContext(group, () =>
24884
24884
inferFromSignature(sourceSignatures[i], targetSignatures[0])
24885
24885
);
24886
24886
}
@@ -25091,8 +25091,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
25091
25091
// introduced.
25092
25092
const freeTypeVariableMapper = makeFreeTypeVariableMapperForContext(context);
25093
25093
const result: Type[] = [];
25094
- for (let i = 0; i < context.inferences.length; i++ ) {
25095
- result.push(instantiateType(getInferredType(context, context.inferences[i] ), freeTypeVariableMapper));
25094
+ for (const inference of context.inferences) {
25095
+ result.push(instantiateType(getInferredType(context, inference ), freeTypeVariableMapper));
25096
25096
}
25097
25097
// Skip calling `accept` when there's only 1 alternative to try, as it can end up fixing expression types, which we can trivially avoid
25098
25098
// in simple cases when the inference result has to be used since it's the only one.
0 commit comments