File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -10913,9 +10913,12 @@ namespace ts {
10913
10913
* circularly references the type variable.
10914
10914
*/
10915
10915
function getResolvedBaseConstraint(type: InstantiableType | UnionOrIntersectionType): Type {
10916
+ if (type.resolvedBaseConstraint) {
10917
+ return type.resolvedBaseConstraint;
10918
+ }
10916
10919
let nonTerminating = false;
10917
- return type.resolvedBaseConstraint ||
10918
- ( type.resolvedBaseConstraint = getTypeWithThisArgument(getImmediateBaseConstraint(type), type) );
10920
+ let stack: Type[] = [];
10921
+ return type.resolvedBaseConstraint = getTypeWithThisArgument(getImmediateBaseConstraint(type), type);
10919
10922
10920
10923
function getImmediateBaseConstraint(t: Type): Type {
10921
10924
if (!t.immediateBaseConstraint) {
@@ -10932,9 +10935,14 @@ namespace ts {
10932
10935
nonTerminating = true;
10933
10936
return t.immediateBaseConstraint = noConstraintType;
10934
10937
}
10935
- constraintDepth++;
10936
- let result = computeBaseConstraint(getSimplifiedType(t, /*writing*/ false));
10937
- constraintDepth--;
10938
+ let result;
10939
+ if (!isDeeplyNestedType(t, stack, stack.length)) {
10940
+ stack.push(t);
10941
+ constraintDepth++;
10942
+ result = computeBaseConstraint(getSimplifiedType(t, /*writing*/ false));
10943
+ constraintDepth--;
10944
+ stack.pop();
10945
+ }
10938
10946
if (!popTypeResolution()) {
10939
10947
if (t.flags & TypeFlags.TypeParameter) {
10940
10948
const errorNode = getConstraintDeclaration(<TypeParameter>t);
You can’t perform that action at this time.
0 commit comments