collectype

collectype v0.11.0


collectype / types/utility / ValueOf

Type Alias: ValueOf<T>

ValueOf<T> = T[keyof T]

Defined in: types/utility.ts:67

Utility type to get the value types of an enum or object.

Type Parameters

T

T

The enum or object type.

Example

enum E { A = 'a', B = 'b' }
type Example = ValueOf<E>; // 'a' | 'b'
type ExampleObj = ValueOf<{ x: 1, y: 2 }>; // 1 | 2