rambdax
Version:
Extended version of Rambda - a lightweight, faster alternative to Ramda
17 lines (14 loc) • 335 B
text/typescript
import {Union} from './Union'
// Credit https://stackoverflow.com/a/50375286/3570903
/**
Transform a [[Union]] to an **intersection**
@param U to transform
@returns `&`
@example
```ts
```
*/
export type IntersectOf<U extends Union> =
(U extends unknown? (k: U) => void : never) extends ((k: infer I) => void)
? I
: never