-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Description
What do you want to know?
I'm updating a couple of things in flowgen (since Flow now supports most of the missing utils)
After updating flow-bin to 0.217, this test started to fail:
it("should use spread when performing union of object types", () => {
const ts = `
type Foo = { foo: number };
type Bar = { bar: string };
const combination: Foo & Bar;
`;
// ...
The jest snapshot is now invalid:
exports[`should use spread when performing union of object types 1`] = `
"declare type Foo = {
foo: number,
...
};
declare type Bar = {
bar: string,
...
};
declare var combination: { ...Foo, ...Bar };
"
`;
I understand the principle that Bar
has a spread and so could contain foo
of the wrong type, but what is the correct way to do this in flow so I can fix the logic? Thanks
Edit: Looking at intersections/#toc-intersections-of-object-types it seems like the correct output should be declare var combination: Foo & Bar
?
Edit edit: Assume that's correct, raised a PR: joarwilk/flowgen#201