typelab / utils / ExtractArray
type ExtractArray<T> = T extends ReadonlyArray<infer U> ? U : never;Extract the value type from an Array type.
| Type Parameter | Description |
|---|---|
|
|
The input type which should be an |
The type of the elements in the Array, or never if T is not an Array.
type Valid = ExtractArray<number[]>; // number
type Invalid = ExtractArray<Promise<number>> // never