I try to use enum value as index of array but it gives me an error.
export class Color {
static RED = 0;
static BLUE = 1;
static GREEN = 2;
}
let x = ['warning', 'info', 'success'];
let anotherVariable = x[Color.RED]; <---- Error: Type 'Color' cannot be used as an index type.
I tried Number() and parseInt to convert to number but it does not work.
Is there any way that I can use Enum values as an index?