type ArrayAt<T, Index> = T extends ReadonlyArray ? _IfNotAnyOrNever<T, PropValue<T, Index>> : never;Extracts the type of an element at a specific index from an Array type.
| Type Parameter | Description |
|---|---|
|
|
The |
|
|
The index of the element to extract. |
The type of the element at index I from type T.
type ElementAt = ArrayAt<[string, number, boolean], 1>; // number
type Undefined = ArrayAt<[string, number, boolean], 3>; // undefined
type Never = ArrayAt<any, 1>; // never