How to transform a union of objects to a plain union with object's values. An example:
type Foo = {};
type Bar = {};
type Baz = {};
type Qux = {};
type Input = {
foo: Foo,
bar: Bar,
} | {
bar: Bar,
baz: Baz,
} | {
qux: Qux,
};
type Expected = Foo | Bar | Baz | Qux;
Pay attention that keys of union's objects may intersect (bar
in example). Hope the solution advance me unwrapping nested typings.