原文:元素隐式具有 "any" 类型,因为类型为 "string" 的表达式不能用于索引类型

遇到这样一个问题,尝试了很多方法没有解决,最后在tsconfig.json文件添加了配置 ...

2021-07-28 10:34 0 1528 推荐指数:

查看详情

ts中类型为 "string" 的表达式能用于索引类型 "{}"。

具体场景为 在我们编写ts代码的时候会出现波浪线警告,鼠标移上去出现以下情况: (property) DateHelper.prmimaryKey: string 元素具有 "any" 类型,因为类型为 "string" 的表达式能用于索引类型 "{}"。 在类型 ...

Sat Oct 17 00:28:00 CST 2020 0 4645
typescript 编译报错 不能用于索引类型

Element implicitly has an 'any' type because expression of type 'any' can't be used to index type 'typeof 备注: 元素具有any类型,因为类型string”的表达式能用于 ...

Thu Jul 02 23:37:00 CST 2020 0 8951
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM