Extracts the element type from a readonly array or tuple type S. If S is not an array or tuple type, it resolves to never.
S
never
The array or tuple type.
The type of the elements within the array/tuple.
type StrElm = ArrayElement<string[]>; // stringtype NumElm = ArrayElement<readonly number[]>; // numbertype TupleElm = ArrayElement<[string, boolean]>; // string | booleantype NotArray = ArrayElement<{ a: number }>; // never Copy
type StrElm = ArrayElement<string[]>; // stringtype NumElm = ArrayElement<readonly number[]>; // numbertype TupleElm = ArrayElement<[string, boolean]>; // string | booleantype NotArray = ArrayElement<{ a: number }>; // never
Extracts the element type from a readonly array or tuple type
S. IfSis not an array or tuple type, it resolves tonever.