@@ -24491,7 +24491,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2449124491 let bivariant = false;
2449224492 let propagationType: Type;
2449324493 let inferencePriority: number = InferencePriority.MaxValue;
24494- let allowComplexConstraintInference = true;
2449524494 let visited: Map<string, number>;
2449624495 let sourceStack: Type[];
2449724496 let targetStack: Type[];
@@ -24697,15 +24696,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2469724696 // getApparentType can return _any_ type, since an indexed access or conditional may simplify to any other type.
2469824697 // If that occurs and it doesn't simplify to an object or intersection, we'll need to restart `inferFromTypes`
2469924698 // with the simplified source.
24700- if (apparentSource !== source && allowComplexConstraintInference && !(apparentSource.flags & (TypeFlags.Object | TypeFlags.Intersection))) {
24701- // TODO: The `allowComplexConstraintInference` flag is a hack! This forbids inference from complex constraints within constraints!
24702- // This isn't required algorithmically, but rather is used to lower the memory burden caused by performing inference
24703- // that is _too good_ in projects with complicated constraints (eg, fp-ts). In such cases, if we did not limit ourselves
24704- // here, we might produce more valid inferences for types, causing us to do more checks and perform more instantiations
24705- // (in addition to the extra stack depth here) which, in turn, can push the already close process over its limit.
24706- // TL;DR: If we ever become generally more memory efficient (or our resource budget ever increases), we should just
24707- // remove this `allowComplexConstraintInference` flag.
24708- allowComplexConstraintInference = false;
24699+ if (apparentSource !== source && !(apparentSource.flags & (TypeFlags.Object | TypeFlags.Intersection))) {
2470924700 return inferFromTypes(apparentSource, target);
2471024701 }
2471124702 source = apparentSource;
0 commit comments