enumUtil.d.ts 609 B

12345678
  1. export declare namespace enumUtil {
  2. type UnionToIntersectionFn<T> = (T extends unknown ? (k: () => T) => void : never) extends (k: infer Intersection) => void ? Intersection : never;
  3. type GetUnionLast<T> = UnionToIntersectionFn<T> extends () => infer Last ? Last : never;
  4. type UnionToTuple<T, Tuple extends unknown[] = []> = [T] extends [never] ? Tuple : UnionToTuple<Exclude<T, GetUnionLast<T>>, [GetUnionLast<T>, ...Tuple]>;
  5. type CastToStringTuple<T> = T extends [string, ...string[]] ? T : never;
  6. export type UnionToTupleString<T> = CastToStringTuple<UnionToTuple<T>>;
  7. export {};
  8. }