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
test.js:5
5: var b: B = a;
^ intersection: object type(s). This type is incompatible with
5: var b: B = a;
^ object type
What's happening here, as far as I can tell, is that Flow tries both branches of the intersection in A one at a time. As if we assigned var b: B = { a: string } then later var b: B = { b: string }. Both of these assignments independently should fail, but if we imagined that both assignments happened "together" should succeed.
I think that lots of issues related to intersection types might reduce to this. Check out linked issues for more examples.
The text was updated successfully, but these errors were encountered:
samwgoldman
changed the title
Intersection of object type should behave as object type with properties from all branches
Intersection of object types should be a valid lower bound of the object type with properties from all branches
Jan 28, 2016
Repro:
What's happening here, as far as I can tell, is that Flow tries both branches of the intersection in A one at a time. As if we assigned
var b: B = { a: string }
then latervar b: B = { b: string }
. Both of these assignments independently should fail, but if we imagined that both assignments happened "together" should succeed.I think that lots of issues related to intersection types might reduce to this. Check out linked issues for more examples.
The text was updated successfully, but these errors were encountered: