typelab / utils / ArrayElements
type ArrayElements<T> = T extends ReadonlyArray ? _IfNotAnyOrNever<T, T[number]> : never;Extracts the elements of an Array type`.
| Type Parameter | Description |
|---|---|
|
|
The target |
Elements of type T.
type Elements = ArrayElements<[string, number]>; // string | number
type Never = ArrayElements<any>; // never