@kaelyx/ts-kit / types / ValueOf
Type Alias: ValueOf<T>
ValueOf<
T> =Textends readonlyunknown[] ?T[number] :T[keyofT]
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