-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix conditional type constraint exploration + signature relations #47341
Conversation
Adding a regression test isn't simple as the repro references multiple NPM packages. |
To be clear, this PR fixes the repro here #47142 (comment). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Individually, these two changes look fine and make sense on their face - the first skips distributive constraints for circularly constrained types, which is good, and the second expands simplified signature matching to instances of the same type reference rather than just instances if the same symbol... which it's weird that the second isn't fully encompassed by the first, which is why an example and repro would be nice, but 🤷♂️, looks fine enough, I suppose.
The change to not explore circular constraint is what fixes the stack overflow. Definitely a good change. The signature relation change keeps us from cross-comparing incompatible signatures. Without it, as we're computing the variance for |
// We have instantiations of the same anonymous type (which typically will be the type of a | ||
// method). Simply do a pairwise comparison of the signatures in the two signature lists instead |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment accurate (i.e. "same anonymous type")?
On DT, this breaks knockout.mapping with
Is this expected? I'll add more detail after investigating. Edit: Here's the rest of the stack. Pretty clear the package relied on the broader signature relation before:
|
Here's a small repro. I'll file it as a separate bug so we can decide whether it's worthwhile to fix: interface Kow<T> {
(value: T): void;
}
declare var src: Kow<true> | Kow<false>;
var tgt: Kow<boolean> = src |
Marking this as a breaking change since the error in #47371 is the intended behavior. |
Fixes #47142.