📌  相关文章
📜  ts enum string' 不能用于索引类型 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:27.285000             🧑  作者: Mango

代码示例1
enum Enum {
    some = 'some text here',
    other = 'other stuff here'
}

(Object.keys(Enum) as Array).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'.
})