rambda
Version:
Lightweight faster alternative to Ramda
14 lines (12 loc) • 334 B
text/typescript
// Credit https://stackoverflow.com/a/50375286/3570903
/** Transform a **union** into an **intersection**
* @param U to transform
* @returns **intersection**
* @example
* ```ts
* ```
*/
export type IntersectOf<U extends any> =
(U extends unknown ? (k: U) => void : never) extends ((k: infer I) => void)
? I
: never