You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We were trying to make changes by looking at the constraint of a type.
In 3rd playground example, the types of obj1 and obj2 should not be related to whatever's being assigned.
The same should be true of obj3, but for various reasons we consider it to be "infinitely expanding" and just let that slip by the type system.
This PR is a bit of a hack on top of a hack to fix that issue; we can recognize that the types are not identical, but you can defeat this with an intersection.
What exactly is the "depth" we're talking about? What stack is being tracked?
We have source type IDs and target type IDs that we place onto a stack.
As we do more comparisons, we check to see whether a comparison we've already done on the stack veratim is there. If so, we say "maybe" the two original types are related.
If the source or target sides have appeared more than N times (where N=5 today), then we mark that side of the comparison as "infinitely expanding", and if both sides are "infinitely expanding", we say the types are "maybe" related.
Not 5 of the same type, 5 of the same "recursion identity, where sometimes a recursion identity is a type object.
When we think we see a repeating pattern, we say "it's similar enough", and hope some other portion of the type will stop us.
Have concern that we'll break something we haven't thought of.
What is the concern? Not issuing an error to issuing an incorrect error?
On one side we have a constraint that keeps on repeating but generating new type identities (never see the same type twice), but we keep entering the logic because we never see the type change.
Tagged Template Inferrence and Making TemplateStringsArray
Consistently Filtering Out Negative Matches when Narrowing
#45205
#41821
Playground Samples
obj1andobj2should not be related to whatever's being assigned.obj3, but for various reasons we consider it to be "infinitely expanding" and just let that slip by the type system.So this avoids tracking "runs" of the same recurring type.
What do you do when you have two types that link back to themselves?
Tagged Template Inferrence and Making TemplateStringsArray
#31422
#33304
#45310
Notes from @RyanCavanaugh
tsalooks like aReadonlyArray<string>, plus arawpropertyT extends stringxisTemplateStringsArrayTPartsandTRawParts