
[英].includes on Angular pipe is returning 'Property 'includes' does not exist on type 'never'.ts(2339)' error message
[英]Property 'length' does not exist on type 'string[]'.ts(2339)
我在 windows 机器上使用 VSCode、React/NextJS 和 Typescript。
一只猫跳上了我的笔记本电脑。 猫走后,我的Typescript突然告诉我,所有的数组方法都不存在。
请看下面的错误代码
编辑:添加示例代码
const hello = ["hi", "hi2", "hi3"]
if (hello.length > 2){
console.log("hi")
}
Error: Property 'length' does not exist on type 'string[]'.ts(2339)
const arrray = ["hi", "hi2", "hi3"]
const why = arrray[1]
Error: Element implicitly has an 'any' type because expression of type '1' can't be used to index type 'string[]'.
Property '1' does not exist on type 'string[]'.ts(7053)
typing arrray. in VSCode gives me 8 options, copyWithin, entries, fill, find, findIndex, flat, flatMap, includes
似乎我找到了解决方法——我所要做的就是将我的 VSCode 更新到最新版本。
现在好像一切都好了。 它还修复了我一段时间以来遇到的其他错误。
但是为什么猫会造成这种情况呢?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.