【问题标题】:Property 'keys' does not exist on type 'any[]'类型“any[]”上不存在属性“keys”
【发布时间】:2018-09-09 00:10:03
【问题描述】:

VS2017 中的下一个示例报告错误:“任何 []”类型上不存在属性“键”

[].keys()

为什么会出错?

Visual Studio 2017 版本 - 15.6.4

TypeScript 工具版本 - 15.6.20202.3

TypeScript 版本 - 2.8

【问题讨论】:

标签: typescript visual-studio-2017


【解决方案1】:

tsconfig.json 修改后问题解决。

tsconfig.json

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

【讨论】:

    【解决方案2】:

    "esnext" 在 tsconfig.json 中使用时对我有用。使用 VS 代码

    【讨论】:

      猜你喜欢
      • 2021-02-08
      • 2019-09-20
      • 2019-12-31
      • 2022-12-17
      • 2021-11-29
      • 1970-01-01
      • 2017-10-20
      • 2017-01-14
      • 2020-01-11
      相关资源
      最近更新 更多