Skip to content

@kaelyx/ts-kit / types / ValueOf

Type Alias: ValueOf<T> ​

ValueOf<T> = T extends readonly unknown[] ? T[number] : T[keyof T]

Defined in: types/value-of/value-of.types.ts:15

Gets the type of the values of an object or array.

Type Parameters ​

T ​

T

Example ​

ts
const obj = { a: 1, b: 2 } as const
const value: ValueOf<typeof obj> = 1 // or 2