export type UnionToIntersection = ( U extends K ? (k: U) => void : never ) extends (k: infer I) => void ? I : never // https://github.com/microsoft/TypeScript/issues/3192#issuecomment-261720275 // https://github.com/microsoft/TypeScript/issues/3192#issuecomment-265568398 // eslint-disable-next-line export function mkenum( x: T, ): T { return x } export type EnumType = T[keyof T] // Util to prepend a value to a Tuple from: https://stackoverflow.com/a/54607819/5308589 export type PrependTuple> = (( a: A, ...b: T ) => void) extends (...a: infer I) => void ? I : [] export type Extends = T extends E ? R1 : R2 export type ExtendsOrNever = Extends // https://stackoverflow.com/a/51365037 export type RecursivePartial = { [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial[] : T[P] extends object ? RecursivePartial : T[P] } // prettier-ignore export type Prev = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62][T]; // https://dev.to/miracleblue/how-2-typescript-get-the-last-item-type-from-a-tuple-of-types-3fh3 export type GetLength = original extends { length: infer L } ? L : never