'Union of Properties' Types

I have a TypeScript type like

type MyType =
{
    fooProp: Foo;
    barProp: Bar;
    bazProp: Baz;
};

How can I define a type which is the union of the type's properties' types, so I can have a type

Foo | Bar | Baz

?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source