Having trouble accessing the enum members of a numeric enum in TypeScript using window[name]. The result is an undefined object.
export enum MyEnum {
MemberOne = 0,
MemberTwo = 1
}
export class ObjectUtils {
public static GetEnumMembers(name: string): Array<string> {
let enumInstance = window[name];
return Object.keys(enumInstance).map((k: any) => enumInstance[k]).filter((x: any) => typeof (x) == "string");
}
}
When trying to call the GetEnumMembers method:
ObjectUtils.GetEnumMembers("MyEnum");
The enumInstance returns as undefined.
edit: Seeking to retrieve a string array with ["MemberOne", "MemberTwo"]