- Notifications
You must be signed in to change notification settings - Fork 13.2k
Fix assignment of intersections to objects with optional properties#37195
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
ahejlsberg commented Mar 3, 2020
@typescript-bot test this |
typescript-bot commented Mar 3, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Heya @ahejlsberg, I've started to run the parallelized Definitely Typed test suite on this PR at f902f8a. You can monitor the build here. |
typescript-bot commented Mar 3, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Heya @ahejlsberg, I've started to run the perf test suite on this PR at f902f8a. You can monitor the build here. Update: The results are in! |
typescript-bot commented Mar 3, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Heya @ahejlsberg, I've started to run the parallelized community code test suite on this PR at f902f8a. You can monitor the build here. |
typescript-bot commented Mar 3, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Heya @ahejlsberg, I've started to run the extended test suite on this PR at f902f8a. You can monitor the build here. |
typescript-bot commented Mar 3, 2020
The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master. |
typescript-bot commented Mar 3, 2020
@ahejlsberg Here they are:Comparison Report - master..37195
System
Hosts
Scenarios
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ahejlsberg commented Mar 4, 2020
@typescript-bot run dt |
typescript-bot commented Mar 4, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Heya @ahejlsberg, I've started to run the parallelized Definitely Typed test suite on this PR at f902f8a. You can monitor the build here. |
ahejlsberg commented Mar 4, 2020
@typescript-bot user test this |
typescript-bot commented Mar 4, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Heya @ahejlsberg, I've started to run the parallelized community code test suite on this PR at 1a5911a. You can monitor the build here. |
weswigham commented Mar 4, 2020
So, notably, this does not fix #36637 because that has a generic |
ahejlsberg commented Mar 4, 2020
That's right. |
typescript-bot commented Mar 4, 2020
The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master. |
ahejlsberg commented Mar 4, 2020
@weswigham Can you take a look at the last user test suite run and tell me which of those are preexisting conditions, or how I might find out? The |
weswigham commented Mar 4, 2020
Looking over #37219 and #37203 , looks like just the |
ahejlsberg commented Mar 5, 2020
Summarizing test runs: No change in RWC and DT and no appreciable perf impact. New errors in the So, this PR is technically a breaking change because we find new issues. |
DanielRosenwasser commented Mar 5, 2020
@typescript-bot pack this |
typescript-bot commented Mar 5, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Heya @DanielRosenwasser, I've started to run the tarball bundle task on this PR at 1a5911a. You can monitor the build here. |
typescript-bot commented Mar 5, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Hey @DanielRosenwasser, I've packed this into an installable tgz. You can install it for testing by referencing it in your and then running There is also a playground for this build. |
DanielRosenwasser commented Mar 5, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
CC @dzearing@JasonGore, it looks like this change will cause issues for Fabric. It looks like tightening the declarations of to use |
We consider any intersection
A & Bassignable to a typeTif eitherAorBis assignable toT. This can be problematic whenTis an object type with optional properties. For example:The issue here is that because
{b: string }is assignable to{a?: number, b: string }we also consider any intersection that includes{b: string }to be assignable--even if the intersection includes another type that conflicts with the optionalaproperty.With this PR we now require intersections of object types as a whole to be assignable to the target type. In other words, we treat
{a: null } &{b: string}identically to{a: null, b: string }in relationships.Fixes#36604.