How to transform union of similar objects to object type using TypeScript typings?
Input
type I = {
key: 'foo',
value: Foo,
} | {
key: 'bar',
value: Bar,
};
Output
type O = {
foo: Foo,
bar: Bar,
};
I am not sure it is possible. But who knows? Note that the task is not a duplicate to that.