In my code, I define an enum like this:
export enum AccountSettings {
accountManagement = "Account management",
managementOfRelatives = 'Management of relatives',
}
Next, I have a file named en.json
, which contains the corresponding data for my enum values
{
"account_management": "Account management",
"management_of_relatives": "Management of relatives",
}
But when I try to use this data in my enum definition, I encounter an error:
import en from './en.json';
export enum AccountSettings {
accountManagement = en.account_management, // displays Type 'string' is not assignable to type 'number'
managementOfRelatives = 'Management of relatives',
}
I'm looking for a solution on how to successfully incorporate the data from en.json
into my enum. Can anyone help with this?