我已将我的应用程序的TypeScript软件包从版本2更新为版本~3.1.6
。
这样做之后,WebStorm似乎无法识别某些内置类(例如Promise
,Date
,JSON
等)。 )
不仅如此,它似乎无法将数组识别为数组。因此,它说.forEach
不存在。当然,仅.forEach
不会发生这种情况。
强制输入也无济于事:
TypeScript和TSLint设置看起来不错:
似乎只有WebStorm很难解决。文件已成功编译,没有任何错误。
{
"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"
]
}
}