i want to catch a type from a union (just about any type)
for example if i have type T = 'a' | 'b' | 'c';
i want to have a type called CatchRandom
so that if type R = CatchRandom<T>;
R will be one of the three types 'a' or 'b' or 'c'
--> in fact i'm building this type Arr to get one array of types from a union of types (array of all types)
type CatchOne<T> = T;
type Arr<U extends string, K extends U = CatchOne<U>, R extends any[] = []> = {
[S in U]: Exclude<U, S> extends never ? [...R, S] : TupleUnion<Exclude<U, S>, [...R, S]>;
}[K];
type UUU = Arr<'a' | 'b', 'a'>;
how can i write the type CatchOne
to catch just any type from that union T
so that i can use it to get a random value
basicaly i want the type UUU to be ["a", "b"]
without specifying that 'a'
everytime, i just pass in the union and i get the array