I am working with a tuple of Maybe
types:
class Maybe<T>{ }
type MaybeTuple = [Maybe<string>, Maybe<number>, Maybe<boolean>];
and my goal is to convert this into a tuple of actual types:
type TupleIWant = [string, number, boolean];
So, I attempted the following approach:
type ExtractTypes<T> = T extends Maybe<infer MaybeTypes>[] ? MaybeTypes : never;
type TypesArray = ExtractTypes<MaybeTuple>; // string | number | boolean NOT [string, number, boolean]
Unfortunately, this solution did not yield the desired outcome.
Instead of getting the tuple [string, number, boolean]
, I ended up with (string | number | boolean)[]
Is it currently possible to achieve what I intended to do?