Creates a new array/tuple type where the element at index I in T is replaced with type V.
If T is a tuple, it returns a new tuple type with the element at I updated.
If T is a general array, it returns a general array type readonly (T[number] | V)[].
Type Parameters
Textendsreadonlyunknown[]
The readonly array or tuple type.
Iextendsnumber
The index to update (must be a valid index for T if T is a tuple).
V
The new type for the element at index I.
Returns
A new array/tuple type with the element at index I updated.
Example
typeSA1 = List.SetAt<[1, 2, 3], 1, 'x'>; // readonly [1, 'x', 3] typeSA2 = List.SetAt<readonlynumber[], 1, 'x'>; // readonly (string | number)[] // type SA3 = List.SetAt<[1, 2], 2, 'x'>; // Error if I is out of bounds for tuple
Creates a new array/tuple type where the element at index
IinTis replaced with typeV. IfTis a tuple, it returns a new tuple type with the element atIupdated. IfTis a general array, it returns a general array typereadonly (T[number] | V)[].