Answers for "ts enum string' can't be used to index type"

0

ts enum string' can't be used to index type

enum Enum {
    some = 'some text here',
    other = 'other stuff here'
}

(Object.keys(Enum) as Array<keyof typeof Enum>).map(x => {
	console.log(TagEnum[x])
// Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'typeof TagEnum'.
// No index signature with a parameter of type 'string' was found on type 'typeof TagEnum'.
})
Posted by: Guest on April-23-2021

Code answers related to "ts enum string' can't be used to index type"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language