-
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
Double (exclusion) inference doesn't narrow union object #61075
Comments
exoRift
changed the title
Double inference doesn't narrow union object
Double (exclusion) inference doesn't narrow union object
Jan 29, 2025
I've devised a workaround for this issue which is to split the property's string union into an upper-level object union |
This was referenced Jan 30, 2025
He linked the original issue. It's marked as design limitation, so it's unlikely to be solved anytime soon. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
π Search Terms
"double inference", "exclusion inference", "union object narrow"
π Version & Regression Information
I observed this issue on versions
β― Playground Link
https://www.typescriptlang.org/play/?ts=5.7.3#code/C4TwDgpgBAKhDOwoF4oAoDeBYAUFfUAxgBYSEDWAXFAOQBOCA9gDYBuEAJjbgVMMQEsAdgHNqQgK4BbAEYQ6uAL5QAPlGx4CJMlVrNGAQw7CRNVbXl1GDLjwL8T1CUI4QAZsM5KAlLlyFGIUQoN0ZGajhg1AxlA3hYBGA-HAE3dFDGADptChRkVBp9IxMzFTUM7NJc-ILLa04ab3U7fAqc8haoAHouqAA9AH5OiodRTp7+oZxlCGZ4aA1eNqqOzXwJweGwzNGRcd7N6dwgA
π» Code
π Actual behavior
foo.check` is `'resolved'` here, but `foo.thing` is still `number | undefined
This is impossible considering the type
π Expected behavior
I expected
foo.thing
to be of typenumber
sincefoo.check
is of type'resolved'
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: