collectype / types/utility / ByType
ByType<
T,Value> = { [P in keyof T as T[P] extends Value | undefined ? P : never]: T[P] }
Defined in: types/utility.ts:27
Selects keys from type T whose value type matches Value or is undefined.
T
The object type to inspect.
Value
The value type to match.
type Example = ByType<{ a: number; b: string; c?: number }, number>;
// Result: { a: number; c?: number }