-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Conditional type triggers "No error for last overload signature" exception #55217
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
Comments
This crash bisects to #51771. @weswigham |
Adding this after if (entry !== undefined) {
// If the previous entry and the result disagree, then something has gone wrong.
Debug.assert(!!(entry & RelationComparisonResult.Succeeded) === (result !== Ternary.False), "Cached relationship does not match recalculated result");
} We first check if two types are related during call resolution. We get a failed relation result the first time, and add the node to a list to process later if all fail, ignoring errors (since a later candidate may work). That happens in this example, but when we check a second time with errors enabled, we somehow decide that they are related and then don't report any errors, firing the debug assert later. |
When errors are not being reported Those variances fail there with:
When errors are reported though the compiler skips over that fast path and continues. It manages to successfully relate those types here with: type DistributiveConstraint = (SubproductNameForProductName<P> extends "a1" ? { a1: { value: "a-a1"; }; }["a1" & SubproductNameForProductName<P>] : never) | (SubproductNameForProductName<P> extends "b1" ? { b1: { value: "b-b1"; }; }["b1" & SubproductNameForProductName<P>] : never)
type Target = DiscriminatedUnion |
Thanks for looking; deleting |
Bug Report
🔎 Search Terms
"No error for last overload signature" yields stale issue 35186, and a couple of more recent issues that got resolved: 48636, 37974. (The stale 35186 appears to be a different issue as it also occurs in versions before v5.0.4.)
🕗 Version & Regression Information
⏯ Playground Link
Bug-workbench link with relevant code
💻 Code
🙁 Actual behavior
The compiler throws an exception:
🙂 Expected behavior
No compiler exception.
The text was updated successfully, but these errors were encountered: