I would like to convert an object type to a comma separated string of its keys.
With input
type Obj = {
val1: string;
val2: string;
val3: string;
}
I want the output
type ObjKeys = GetObjKeys<Obj>;
// 'val1,val2,val3'
Is this possible to obtain?
I'm trying to get a better type safety for an api middle layer I'm building. With an expected output certain fields should be fetched, and those should be typed in a specific manner for it to work. I like to make it mandatory to fetch the fields necessary to populate the expected output type. In that way trying to minimise possible errors.