devtypes - v2.0.0
    Preparing search index...

    Type Alias Intersect<T>

    Intersect: T extends [infer F, infer S, ...(infer R)]
        ? F & S | Intersect<[S, ...R]> | Intersect<[F, ...R]>
        : T extends [infer F, infer S] ? F & S : never

    Compute intersections across multiple types and unions.

    Type Parameters

    • T extends unknown[]

      Tuple of types

    Finds common members among a tuple of types or unions. Useful for detecting overlapping keys or values.

    Will return never if only one type is given.

    Can be slow for large tuples due to combinatorial explosion.

    type KeysA = 'a' | 'aa'
    type KeysB = 'a' | 'bb'
    type KeysX = 'x' | 'bb'
    type Int1 = Intersect< [ KeysA, KeysB, KeysX ] > // 'a' | 'bb'
    type Int2 = Intersect< [ true, false, 1, true ] > // true