I'm trying to get access to property by string variable in TypeScript. When I write d["account_type"]
everything is ok, but when I use one of enums Dictionary
and write d[Dictionary.AccountType]
, I see the error:
Element implicitly has an 'any' type because type 'Dictionaries' has no index signature.
this.dictionaries.toPromise().then(d => { return d["account_type"] });
export enum Dictionary {
AccountType = "account_type",
AddressType = "address_type",
CardBrand = "card_brand",
ContactType = "contact_type",
Country = "country",
DevicePayDay = "device_pay_type",
LogType = "log_type",
PaymentProvider = "payment_provider",
PaymentType = "payment_type",
Permission = "permission",
PointProperty = "point_property",
PointService = "point_service",
PromoSchemaOn = "promo_schema_on",
PromoSchemaOff = "promo_schema_off",
ReportType = "report_type",
}
Is there any way to get access to object properties by enum string value?