How do I iterate over enum items in TypeScript? I tried for-in, but this iterates over strings. I need to call a function for each enum value.
for (const foo in FooType) {
// here I have error that string is not assignable to parameter of type FooType
this.doCalculation(foo)
}
private doCalculation(value: FooType): void {
// some logic
}
enum FooType
looks like this:
export enum SupportedFiat {
VALUE_A = 'VALUE_A',
VALUE_B = 'VALUE_B',
VALUE_C = 'VALUE_C'
}
this.doCalculation(FooType[foo])