add an `enum` type
sam-goodwin opened this issue · comments
It should be possible to create types that resemble enums.
E.g.
const type = enum('a', 'b'): // is of Type<'a' | 'b'>
Probably do with function overloading
function enum<A1 extends string>(a: A1): Enum<A1>
function enum<A1 extends string, A2 extends string>(a: A1, a2: A2): Enum<A1 | A2>
// etc.