Skip to content

Commit fc5d7e9

Browse files
committed
Don't obtain constraint if doing so would cause circularity
1 parent fd620c9 commit fc5d7e9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16572,7 +16572,8 @@ namespace ts {
1657216572
if (t.flags & (TypeFlags.AnyOrUnknown | TypeFlags.InstantiableNonPrimitive | TypeFlags.Object | TypeFlags.Intersection) && t !== wildcardType && !isErrorType(t)) {
1657316573
if (!type.declaration.nameType) {
1657416574
let constraint;
16575-
if (isArrayType(t) || (t.flags & TypeFlags.Any) && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, or(isArrayType, isTupleType))) {
16575+
if (isArrayType(t) || t.flags & TypeFlags.Any && findResolutionCycleStartIndex(typeVariable, TypeSystemPropertyName.ImmediateBaseConstraint) < 0 &&
16576+
(constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, or(isArrayType, isTupleType))) {
1657616577
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
1657716578
}
1657816579
if (isGenericTupleType(t)) {

0 commit comments

Comments
 (0)