-
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
Spreading object breaks optional enum #4682
Comments
I tend to agree I would expect this to work. If you need a workaround right away, this small change is ugly but makes everything work as expected. I'm also curious why you would set a value for a field in the same object where you then spread in an object that will definitely override the value for that field. I'm sure there is some larger context to the real code, so if you share that maybe we can find a solution. |
@asolove
actually answered mine...
I indeed did not mean to spread this way and fixing the order fixes the issue for me Anyway, I strongly believe there is a defect and this is ONE bug it might trigger |
Yeah, could be: if you find another case let us know! |
@asolove Long time no... read As you can see, as opposed to my initial example, I now really want to spread last, not first, since I am overriding the values |
I think this fixes the issue: #7298 |
This no longer errors in master |
The following very simple snippet shows an error which, I am very certain, is wrong.
When fiddling with it a bit, it seems to be related to 2 conditions:
field
allowingnull
, hence being an optionalstate
(that should have a validfield
) being spread into thereturn
valuehttps://flow.org/try/#0PTAEAEDMBsHsHcBQiAuBPADgU1AZRQIYpYAqmOAvKAN6KiiQCWW0AJgFygDkAogHIBVALIB9AGoBBADICeXUAB9QAOwCu0aIgC+AbmRYAHhlgAnFKFZZIBdecirlAYxSNYyhrFgAKOqADOhMSc+ESk5IgAlDS+JlgoqibutPT0TCwcKurQADS+9AB0hQGhoCCgsQC2sABuOCgAFox+oATKrP5YOMqwoFgmJqZ+vrraiEA
I ran into this when writing a new redux reducer (though I did not understand yet why this never happened before).
Tested on Flow Try on
master
,0.53.1
,0.53.0
,0.52.0
,0.51.1
,0.51.0
The text was updated successfully, but these errors were encountered: