Type Alias: PickByValue<T, V>
PickByValue<
T,V> ={ [P in keyof T]: T[P] extends V ? P : never }[keyofT] & keyofT
Defined in: types.ts:178
Gets all the keys (as a string union) from a type T that match value V
Type Parameters
| Type Parameter |
|---|
T |
V |
Example
interface Sample {
id: string;
name: string | null;
middleName?: string;
lastName: string;
hobbies: readonly string[];
}
type BB = PickByValue<Sample, string>;
// Expected:
// "id" | "lastName"