We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
generic union inference
https://www.typescriptlang.org/play?ts=5.3.0-dev.20231031#code/CYUwxgNghgTiAEYD2A7AzgF3lAXPAPAKIA08AKgHwAUIAlhgBYgx4DaAZlBGiKYQLrwAPvFYYYAV17l+ASngBeCvABuSWsACwAKB2hIsBMnRYARm07dpmGLRQBzQSLGTpKCQFtTzfjp1QqU1kdIA
declare const a: <E, T>(either: [false, E] | [true, T]) => void declare const b: [false, string] | [true, number] // now: const a: <string, string>(either: [false, string] | [true, string]) => void // expected: const a: <string, number>(either: [false, string] | [true, number]) => void a(b)
Both parameters: E and T are inferred as strings
E
T
Parameter E is inferred as a string, parameter T is inferred as a number
No response
The text was updated successfully, but these errors were encountered:
Possibly related to #45809?
Also looks like #55648 (comment)
Sorry, something went wrong.
Agree this is duplicate of #45809; tuple and object type discriminants work the same way
No branches or pull requests
🔎 Search Terms
generic union inference
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play?ts=5.3.0-dev.20231031#code/CYUwxgNghgTiAEYD2A7AzgF3lAXPAPAKIA08AKgHwAUIAlhgBYgx4DaAZlBGiKYQLrwAPvFYYYAV17l+ASngBeCvABuSWsACwAKB2hIsBMnRYARm07dpmGLRQBzQSLGTpKCQFtTzfjp1QqU1kdIA
💻 Code
🙁 Actual behavior
Both parameters:
E
andT
are inferred as strings🙂 Expected behavior
Parameter
E
is inferred as a string, parameterT
is inferred as a numberAdditional information about the issue
No response
The text was updated successfully, but these errors were encountered: