utilitypes-ts
    Preparing search index...

    Type Alias UnionToIntersection<T>

    UnionToIntersection: (T extends T ? (value: T) => void : never) extends (
        value: infer R,
    ) => void
        ? R & T
        : never

    Converts a union type into an intersection type.

    Type Parameters

    • T

      The union type to convert

    type Result = UnionToIntersection<
    | { a: string }
    | { b: number }
    >;
    // ^?
    // { a: string } & { b: number }