//#region src/type-utils.d.ts /** Collapse an intersection into a single readable object type on hover. */ type Prettify = { [K in keyof T]: T[K] } & {}; /** Turn a union `A | B | C` into the intersection `A & B & C`. */ type UnionToIntersection = (U extends unknown ? (x: U) => void : never) extends ((x: infer I) => void) ? I : never; /** * Convert a kebab-case literal to camelCase: `"magic-link"` -> `"magicLink"`. */ type KebabToCamel = S extends `${infer Head}-${infer Tail}` ? `${Head}${Capitalize>}` : S; /** Split a string literal into a tuple on a delimiter, dropping empty segments. */ type Split = S extends `${infer Head}${D}${infer Tail}` ? Head extends "" ? Split : [Head, ...Split] : S extends "" ? [] : [S]; /** Check if a type is `any`. */ type IsAny = 0 extends 1 & T ? true : false; //#endregion export { IsAny, KebabToCamel, Prettify, Split, UnionToIntersection };