Type Alias: ArrayElementType<T>
ArrayElementType<
T> =Textends infer K[] ?K:Textends readonly infer RK[] ?RK:T
Defined in: types.ts:237
Gets a union type of all the keys that are in an array.
Type Parameters
| Type Parameter |
|---|
T |
Example
const sample = [1, 2, '3', true];
type arrayUnion = ArrayElementType<typeof sample>;
// Expected: string | number | boolean