Does exist, or is there a way, to be able to use something like this:
type X<Obj, FieldType> = ???;
interface A {
a: number;
b: number;
c: string;
d: Date;
}
type Nums = X<A, number>; // == 'a' | 'b'
type Strings = X<A, string>; // == 'c'
type Dates = X<A, Date>; // == 'd'
where X
is the generic type I am looking for (subset of keyof Obj
, in this case keyof A
).