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
union narrowing wrong
in 3.7.5. still there in 4.3.2
??
Playground link with relevant code
type A = { a: number, b: string }[] type B = { a: number }[] declare var c: A | B | undefined; const d = c ?? [] // d is now just B, but should be A | B
Type inference excludes a part in the intersection type.
Type inference should just exclude undefined, because the ?? operator was used on the variable.
undefined
The text was updated successfully, but these errors were encountered:
That's a union type, not an intersection.
Sorry, something went wrong.
whoops. You're right. With that correction, I was able to find related issues: #44401 #43825 #43667
which are almost the same, but not quite.
See: #32237 (comment)
No branches or pull requests
Bug Report
🔎 Search Terms
union narrowing wrong
🕗 Version & Regression Information
in 3.7.5. still there in 4.3.2
??
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
Type inference excludes a part in the intersection type.
🙂 Expected behavior
Type inference should just exclude
undefined
, because the??
operator was used on the variable.The text was updated successfully, but these errors were encountered: