类型“any[]"上不存在属性“keys" [英] Property 'keys' does not exist on type 'any[]'

查看:58
本文介绍了类型“any[]"上不存在属性“keys"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VS2017 中的下一个示例报告错误:属性 'keys' 在类型 'any []' 上不存在

Next example in VS2017 reported error: Property 'keys' does not exist on type 'any []'

[].keys()

为什么会出错?

Visual Studio 2017 版本 - 15.6.4

Version of Visual Studio 2017 - 15.6.4

TypeScript 工具版本 - 15.6.20202.3

Version of TypeScript tools - 15.6.20202.3

TypeScript 版本 - 2.8

Version of TypeScript - 2.8

推荐答案

tsconfig.json 更改后问题修复.

The problem fixed after tsconfig.json changing.

tsconfig.json

tsconfig.json

"compilerOptions": {
  ..
  "lib":["es2015"]
  ..
}

这篇关于类型“any[]"上不存在属性“keys"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆