You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While playing around it seemed to come down with flow inferring the type of the field foo to null and then regarding the spreaded string as a mismatch.
This can be fixed by reversing the order of spreads and default values like so:
Unfortunately, this comes at the cost of requiring the explicit listing of each potentially overriding field.
This is the most common error in our code base as it is basically showing up everytime when spreading different sets of props into React components in unit tests.
The text was updated successfully, but these errors were encountered:
For what it's worth your first example works if you use undefined instead of null. I couldn't find anthing in the docs that says those are treated differently in this case though.
@chisui Yes, I actually figured that out already. Since I understand ‘?’ to be the idiomatic way of expressing optional values without distinguishing between undefined and null I believe this should be addressed, am I correct?
I was able to reproduce this error in a very minimal code snippet:
https://flow.org/try/#0PTAEAEDMBsHsHcBQjIFcB2BjALgS1uqGugBQAOATrGQM4CUoA3ogJCYE3agBuAhtLgAmALiZFYsUQH5OFXOgDmoAL6gAvGMgTR6VNGgAaUADpTlajRUBuRMuTESjcZNAAibAFNOrlXURA
While playing around it seemed to come down with flow inferring the type of the field
foo
tonull
and then regarding the spreaded string as a mismatch.This can be fixed by reversing the order of spreads and default values like so:
https://flow.org/try/#0PTAEAEDMBsHsHcBQjIFcB2BjALgS1uqGugBQAOATrGQM4CUoA3ogJCYE3agBuAhtLgAmALiZFYsUQH5OFXOgDmoAL6gAvGIB02ytRoAacZNC7amyBNAAfK6HSpo0FQG5Ey5MRKMjogETYAU05fFTpEIA
Unfortunately, this comes at the cost of requiring the explicit listing of each potentially overriding field.
This is the most common error in our code base as it is basically showing up everytime when spreading different sets of props into React components in unit tests.
The text was updated successfully, but these errors were encountered: