Here's an example of an enum:
export enum Colors {
RED = "RED COLOR",
BLUE = "BLUE COLOR",
GREEN = "GREEN COLOR"
}
Can you help me figure out how to retrieve the enum key based on a specific value? For instance, if I input "BLUE COLOR", I should get back 'BLUE'.
Colors["BLUE COLOR"]
triggers an error that says
Element implicitly has an 'any' type because expression of type '"BLUE COLOR"' can't be used to index type 'typeof Colors'. Property 'BLUE COLOR' does not exist on type 'typeof Colors'.