-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Make literal types not comparable to weak object types without property overlap #49865
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
@typescript-bot test this |
Heya @andrewbranch, I've started to run the extended test suite on this PR at fccbbe8. You can monitor the build here. |
Heya @andrewbranch, I've started to run the diff-based user code test suite on this PR at fccbbe8. You can monitor the build here. Update: The results are in! |
Heya @andrewbranch, I've started to run the parallelized Definitely Typed test suite on this PR at fccbbe8. You can monitor the build here. |
@andrewbranch |
Heya @andrewbranch, I've run the RWC suite on this PR - assuming you're on the TS core team, you can view the resulting diff here. |
Unless @DanielRosenwasser has some reason to object, we might want to hold this until 4.9 to be safe. The existing behavior is long-standing and this could turn up new errors in comparisons. |
Change function type to indicate that `true` is also a possible input value. This was found by TypeScript 4.9 See microsoft/TypeScript#49865
Change function type to indicate that `true` is also a possible input value. This was found by TypeScript 4.9 See microsoft/TypeScript#49865
Previously, a type
"A"
was comparable with type{ weak?: boolean }
because we don’t do common property checks for comparability. That leads to poor narrowing behavior in unions between these types. This PR allows common property checks for comparability to proceed if the source is a literal type.Fixes #48858