devtypes - v2.1.0
    Preparing search index...

    Type Alias ListNoDuplicate<L>

    ListNoDuplicate: L extends readonly [infer F, ...(infer R)]
        ? IsTypeInList<F, R> extends true ? never : L
        : L

    Enforces that a tuple contains no duplicate types.

    Type Parameters

    • L extends readonly any[]

      Tuple type to validate

    This will recursively check each type in the tuple L against the rest of the tuple to ensure that no type appears more than once. If a duplicate is found, the type resolves to never.

    type Unique = ListNoDuplicate< [ 1, false, true ] >;        // [ 1, false, true ]
    type Duplicate = ListNoDuplicate< [ 1, false, true, 1 ] >; // never