WebStorm-在TypeScript 3中找不到内置js类的名称

时间:2018-12-05 18:16:53

标签: typescript webstorm jetbrains-ide tslint

我已将我的应用程序的TypeScript软件包从版本2更新为版本~3.1.6

这样做之后,WebStorm似乎无法识别某些内置类(例如PromiseDateJSON等)。 )

Cannot find name 'Promise'

Cannot find name 'JSON'

不仅如此,它似乎无法将数组识别为数组。因此,它说.forEach不存在。当然,仅.forEach不会发生这种情况。

Property 'forEach' does not exists on type '{}'

强制输入也无济于事:

Property 'forEach' does not exists on type '{}'

TypeScript和TSLint设置看起来不错:

Typescript settings

TSLint settings

似乎只有WebStorm很难解决。文件已成功编译,没有任何错误。

tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "es2015",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ]
  }
}

0 个答案:

没有答案