Type alias UnionToIntersection<Union>

UnionToIntersection<Union>: (Union extends unknown
        ? ((u) => void)
        : never) extends ((u) => void)
    ? Intersection
    : never

UnionToIntersection

Type Parameters

  • Union

    The union to convert

Desc

Convert a union to an intersection

Returns

An intersection

Example

type Union = { a: string } | { b: number };
type Intersection = UnionToIntersection<Union>; // { a: string } & { b: number }