@@ -10,7 +10,6 @@ import (
1010 "github.com/microsoft/typescript-go/internal/binder"
1111 "github.com/microsoft/typescript-go/internal/collections"
1212 "github.com/microsoft/typescript-go/internal/core"
13- "github.com/microsoft/typescript-go/internal/debug"
1413 "github.com/microsoft/typescript-go/internal/diagnostics"
1514 "github.com/microsoft/typescript-go/internal/jsnum"
1615 "github.com/microsoft/typescript-go/internal/tracing"
@@ -3035,6 +3034,8 @@ func (r *Relater) eachTypeRelatedToSomeType(source *Type, target *Type) Ternary
30353034// and issue an error. Otherwise, actually compare the structure of the two types.
30363035func (r * Relater ) recursiveTypeRelatedTo (source * Type , target * Type , reportErrors bool , intersectionState IntersectionState , recursionFlags RecursionFlags ) Ternary {
30373036 if r .overflow {
3037+ // Note that stack depth overflows can cause _any_ relation involving structured types to become false, so it is
3038+ // important to have well-defined behavior even in cases that shouldn't normally occur.
30383039 return TernaryFalse
30393040 }
30403041 id , constrained := getRelationKey (source , target , intersectionState , r .relation == r .c .identityRelation , false /*ignoreConstraints*/ )
@@ -4722,7 +4723,6 @@ func (r *Relater) reportRelationError(message *diagnostics.Message, source *Type
47224723 // to be displayed for use-cases like 'assertNever'.
47234724 if target .flags & TypeFlagsNever == 0 && isLiteralType (source ) && ! r .c .typeCouldHaveTopLevelSingletonTypes (target ) {
47244725 generalizedSource = r .c .getBaseTypeOfLiteralType (source )
4725- debug .Assert (! r .c .isTypeAssignableTo (generalizedSource , target ), "generalized source shouldn't be assignable" )
47264726 generalizedSourceType = r .c .getTypeNameForErrorDisplay (generalizedSource )
47274727 }
47284728 // If `target` is of indexed access type (and `source` it is not), we use the object type of `target` for better error reporting
0 commit comments