After defining the following enum:
export enum Types {
Type1 = 1,
Type2 = 2,
...
}
We can create an array based on this enum with the function below:
export function EnumKeys<T>(obj: object): string[] {
return Object.keys(obj)
.filter(value => isNaN(Number(value)) === false)
.map(key => obj[key]);
}
The EnumKeys function currently returns a string[], but I require it to return [keyof typeof T]