devtypes - v2.0.0
    Preparing search index...

    Type Alias TupleHas<T, V>

    TupleHas: T extends readonly [infer H, ...(infer R)]
        ? [H] extends [V] ? true : TupleHas<R, V>
        : false

    Check if a tuple includes a specific type.

    Type Parameters

    • T extends readonly any[]

      Tuple type

    • V

      Type to check for

    Recursively checks each element of the tuple to see if it matches the specified type.

    type HasString = TupleHas< [ number, string, boolean ], string >;  // true
    type HasDate = TupleHas< [ number, string, boolean ], Date >; // false