-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Double (exclusion) inference doesn't narrow union object #61075
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
I've devised a workaround for this issue which is to split the property's string union into an upper-level object union |
He linked the original issue. It's marked as design limitation, so it's unlikely to be solved anytime soon. |
This issue has been marked as "Duplicate" and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
π 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: