Union to Intersection
Convert union to intersection types
- #typescript
export type UnionToIntersection<T> = (T extends any ? (k: T) => void : never) extends (
// without this extends you get `T`
k: infer I,
) => void
? I
: never;
Convert union to intersection types
export type UnionToIntersection<T> = (T extends any ? (k: T) => void : never) extends (
// without this extends you get `T`
k: infer I,
) => void
? I
: never;