I'm encountering an issue when attempting to utilize an enum value as an index for an array.
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've attempted using Number() and parseInt to convert the enum value to a number, but it hasn't resolved the error.
Is there a workaround that would enable me to use Enum values as valid indexes?