Extracts the value types of an object T.
T
By default, it returns a union of all property values. You can optionally provide a subset of keys K to extract only specific value types.
K
The target object type
Keys of T to extract values from (defaults to all keys)
type Result = ValueOf<{ a: string; b: number }>;// ^?// string | number Copy
type Result = ValueOf<{ a: string; b: number }>;// ^?// string | number
type Result = ValueOf<{ a: string; b: number; c: boolean }, "a" | "c">;// ^?// string | boolean Copy
type Result = ValueOf<{ a: string; b: number; c: boolean }, "a" | "c">;// ^?// string | boolean
type Result = ValueOf<{ a: string } | { b: number }>;// ^?// string | number | undefined Copy
type Result = ValueOf<{ a: string } | { b: number }>;// ^?// string | number | undefined
Extracts the value types of an object
T.By default, it returns a union of all property values. You can optionally provide a subset of keys
Kto extract only specific value types.