-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Intersection of objects 3+ levels deep. #725
Comments
Interesting issue! I am able to reproduce. I tried the same code without the object spread (duplicating the |
Possibly, or at the very least how flow handles var a: TypeA = {a:'a'};
var b: TypeB = Object.assign({},{b:'b'},a);
var c: TypeC = Object.assign({},{c:'c'},b); But this code without using intersections at all type checks just fine, so I'm not really sure ... /* @flow */
type TypeA = {
a: string
};
type TypeB = {
a: string,
b: string
};
type TypeC = {
a: string;
b: string;
c: string;
};
var a: TypeA = {a:'a'};
var b: TypeB = Object.assign({},{b:'b'},a);
var c: TypeC = Object.assign({},{c:'c'},b);
var _a: TypeA = {a:'a'};
var _b: TypeB = {..._a,b:'b',};
var _c: TypeC = {..._b,c:'c'}; |
if it's spread related, i'm working on more correctly modeling spreads and that might fix it. there's also a bug with unions (and possibly intersections?) with nested type variables, whereby the |
I tested this against my hack to fix the nested speculative match issue and it either a) doesn't solve this case or b) shows that this error is something else. |
So from what I can tell, this is actually a special case of a much simpler bug. Unfortunately, that bug is a bit nontrivial to fix. I'm going to create a high level issue, close this one w/ a link to the new one. I'm trying to groom the GH issues a bit to increase the signal, so we can react to important stuff like this more easily. Thanks for the report & simple repro case. Will follow up with a link to the superseding issue. |
Merging with #1329. Thanks for the report! |
I'm getting an error when I try to have an object intersection that references an object interaction, that references another object. The error is about the property on the first object in the chain.
Here is the code:
And the error:
Finally, raw code without line numbers:
The text was updated successfully, but these errors were encountered: