Generic modules, Enums and AnyOf
There are at least 3 threads asking for
I suggest making a Enum generic (called
OneOfI suggest making a Enum generic (called
OneOf maybe) that works as following:- it accepts an object definition
O - it has a root type which allows any of the property values
O[keyof O] - it is a module with all property types as its values,
Module<{ [K in keyof O]: Type<O[K]> }>
Then it's easy to use it for both cases of an enum with constant values
and when you just want to intersect a bunch of types