ts-type-forge
    Preparing search index...

    Type Alias SetAt<T, I, V>

    SetAt: SetAtImpl<T, I, V, readonly []>

    Creates a new readonly tuple type where the element at index I in T is replaced with type V.

    Type Parameters

    • T extends readonly unknown[]

      The readonly tuple type.

    • I extends number

      The index to update (must be a valid index literal for T).

    • V

      The new type for the element at index I.

    A new readonly tuple type with the element at index I updated.

    type SA1 = Tuple.SetAt<[1, 2, 3], 1, 'x'>; // readonly [1, 'x', 3]
    // type SA2 = Tuple.SetAt<[1, 2], 2, 'x'>; // Error: Index '2' is out of bounds.