typescript常见问题集锦


1.在ts中,碰到Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Object'.   No index signature with a parameter of type 'string' was found on type 'Object'.

这种问题测出现时说:元素隐式具有“any”类型,因为“string”类型的表达式不能用于索引类型“Object”。在类型“Object”上找不到“string”类型参数的索引签名。

要想解决这类问题,需要在tsconfig.json文件中配置:"suppressImplicitAnyIndexErrors": true 就可以解决此类问题。

2.在vue中,使用此命令 vue add @vue/typescript,出现如下错误得时候:

 

 在对应得文件夹中删除vue.ps1就ok了。

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM