mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 07:13:45 -05:00
Explore fewer constraints in getResolvedBaseConstraint (#48613)
This commit is contained in:
@@ -12107,7 +12107,7 @@ namespace ts {
|
||||
if (type.resolvedBaseConstraint) {
|
||||
return type.resolvedBaseConstraint;
|
||||
}
|
||||
const stack: Type[] = [];
|
||||
const stack: object[] = [];
|
||||
return type.resolvedBaseConstraint = getTypeWithThisArgument(getImmediateBaseConstraint(type), type);
|
||||
|
||||
function getImmediateBaseConstraint(t: Type): Type {
|
||||
@@ -12122,8 +12122,9 @@ namespace ts {
|
||||
// levels of nesting, we are presumably exploring a repeating pattern with a long cycle that hasn't
|
||||
// yet triggered the deeply nested limiter. We have no test cases that actually get to 50 levels of
|
||||
// nesting, so it is effectively just a safety stop.
|
||||
if (stack.length < 10 || stack.length < 50 && !isDeeplyNestedType(t, stack, stack.length)) {
|
||||
stack.push(t);
|
||||
const identity = getRecursionIdentity(t);
|
||||
if (stack.length < 10 || stack.length < 50 && !contains(stack, identity)) {
|
||||
stack.push(identity);
|
||||
result = computeBaseConstraint(getSimplifiedType(t, /*writing*/ false));
|
||||
stack.pop();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user