-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Object spread properties not working as expected #1511
Comments
This doesn't have anything to do with intersections, but is instead a bug in how we process spreads. Smaller repro without intersections:
|
Merging objects with Object.assign also seems to repro this. |
Any news on this? Here is minimal repro:
|
Related: It seems that you cannot return a spread object typed as a disjoint union member, even when it (I think?) can only possibly return the correct value. For example, I would expect the following to pass flow checks:
It instead fails with the following error:
|
^ That is not a solution. The problem still exists and I won't be using Flow until this is rectified. |
Is there still no solution to this? Is there a workaround? Seems like a pretty big issue. |
@rsolomo your type for
Check out my comments on #5253 to see why I believe this is actually correct behaviour for flow. |
this fixes the issue: #7298 |
This code no longer errors in master |
Hey! I'm trying to work with some intersection types and using ES object spread syntax to update my data records. I'm not seeing the behaviour I would expect however.
In the following code I am seeing errors when I would expect it to work fine.
The errors I see are:
With my naivety I would expect flow to be able to see I am merging
{accepted: true}
withproj
so it could safely assume that the result of that will satisfyPendingProject
and{accepted: true}
(AcceptedProject
?)Thanks in advance! :)
The text was updated successfully, but these errors were encountered: