Extract keys of an object whose values match a type.
The object type to filter
The value type to match
Filters object keys based on their value type. Useful for mapping or picking properties programmatically.
type Obj = { a: number; b: string; c: number; d: boolean };type NumKeys = KeysByValue< Obj, number >; // 'a' | 'c' Copy
type Obj = { a: number; b: string; c: number; d: boolean };type NumKeys = KeysByValue< Obj, number >; // 'a' | 'c'
Extract keys of an object whose values match a type.