Looking to define a new type containing all values from an object, with the following structure:
const MyBar = {
Benchpress : 1,
Squats : 2
} as const;
An attempt was made to create a type but encountered difficulties:
type EnumLike<T extends {}> = (obj: T) => typeof obj[keyof typeof obj];
The desired outcome is something akin to this:
type BarKeys = EnumLike(MyBar); // BarKeys 1|2
Questioning whether this goal is achievable?