I have the following string enum:
export enum ReportGraphTypes {
OverallGraph = "Long description...",
OverallByDateGraph = "....",
MilageGraph = "....",
FuelPricesGraph = "....",
FuelConsumptionGraph = "...."
}
Then I map the enum to select field and use the enum key as a value.
I want to pass a default value to my select field and always can do the following:
let selected = "OverallGraph"; but that's hardcoded.
I also tried:
let selected = ReportGraphTypes[ReportGraphTypes.OverallGraph]; but I got the following error:
Element implicitly has an 'any' type because expression of type 'ReportGraphTypes.FuelPricesGraph' can't be used to index type 'typeof ReportGraphTypes'.
What is the best way to assign that key to my variable?