- Notifications
You must be signed in to change notification settings - Fork13.2k
Relate source types covered by a target discriminated union#30779
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 ourterms of service andprivacy 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
rbuckton commentedApr 5, 2019
@typescript-bot test this |
typescript-bot commentedApr 5, 2019 • 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.
typescript-bot commentedApr 5, 2019 • 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.
rbuckton commentedApr 6, 2019
@typescript-bot perf test |
typescript-bot commentedApr 6, 2019 • 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.
rbuckton commentedApr 6, 2019
Pardon the dust, tinkering with the on-demand benchmark script to not generate a massive wall of text when posting the results. |
04d985e to8321adfCompareRyanCavanaugh commentedApr 19, 2019
RyanCavanaugh commentedApr 19, 2019
Also#20889 |
rbuckton commentedApr 19, 2019
@RyanCavanaugh: I've added tests and verified that this does indeed fix those issues. |
rbuckton commentedApr 19, 2019
@ahejlsberg: Can you take a look? |
ahejlsberg left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'd inline the constant instead of shouting all caps.
jcalz commentedMay 30, 2019 • 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.
Hmm, why doesn't#12052 seem to link back to this issue? Oh, does locking an issue actually prevent it from getting new "@somebody mentioned this" links? That's too bad... it becomes much harder to follow up on these longstanding issues. |
Uh oh!
There was an error while loading.Please reload this page.
This PR effects how we relate a source "Object" type to a target union type when:
For example, today if we were to change
IteratorResultto be a discriminated union, the following example would no longer compile:With this change, we will perform the following steps after all other relationship checks fail:
If 'source' is an Object type and 'target' is a Union type with discriminant properties:
This means that now, for the example above, we perform the following steps:
Swith respect toT:["done"][[true, false]][[true], [false]]Tto the matching discriminantscm ofc:[T0, T1]["value"]) ofSandcm.S["value"]is related to bothT0["value"]andT1["value"], thereforeSis related toT.Further examples can be found inassignmentCompatWithDiscriminatedUnion.ts
Related:#2983
Fixes:#14865
Fixes:#30871
Fixes:#30170
Fixes:#12052
Fixes:#18421
Fixes:#15907
Fixes:#20889