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
Intersection types are awfully useful when working with react and passing down props from bigger components to smaller more specialised ones, however the lack of support for spread operator makes it very hard to work with (unless I'm missing something).
I noticed #1329 is "checked" and the issue has been closed in March. Does it mean it's been solved? If so, in which version/branch can we access this feature?
Looks like one of the scenarios has been fixed in 0.50.0:
function bar(x: T): void {
let z: T = { ...x }; // error - now fixed in 0.50.0
}
But the following seems to be problematic:
/* @flow */
type T = { foo: string } & { bar: number };
function bam({bar}: {bar: number}): number {
return bar + 2;
}
function bar(x: T): void {
let { foo, ...props } = x;
bam(props); //error
}
Here's the reported error:
5: function bam({bar}: {bar: number}): number {
^ property `bar`. Property not found in
11: bam(props); //error
^ rest of object pattern
The text was updated successfully, but these errors were encountered: