我正在尝试在项目上运行Webpack,我遇到了多个错误
node_modules/@types/core-js/index.d.ts
error TS2304: Cannot find name 'PropertyKey'.
...
node_modules/@types/core-js/index.d.ts
error TS2339: Property 'for' does not exist on type 'SymbolConstructor'.
Run Code Online (Sandbox Code Playgroud)
我应该安装所有的打字机,所以我不确定它们来自哪里.我尝试从一个编译的项目复制一个package.json,但它没有帮助.我错过了什么?
我的tsconfig看起来像这样
{
"compilerOptions": {
"target": "es5",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules",
"**/*.spec.ts"
]
}
Run Code Online (Sandbox Code Playgroud)
Kem*_*aya 38
@type/core-js在0.9.35时遇到同样的错误
可能是别的..
编辑
上周回购有一些变化.您可以在github上阅读该问题,并通过以下链接查看更改:
https://github.com/DefinitelyTyped/DefinitelyTyped/issues/15104
我的解决方案是改变
"lib": ["es5", "dom"]到我的tsconfig文件"lib": ["es6", "dom"]中的compilerOptions对象.
通过这样做,我使错误消失而不降级到0.9.35
注意:你不需要改变目标(我的仍然是es5)
对我来说答案是......
"compilerOptions": {
...
"lib": [
"es2016",
"dom"
]
},
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9969 次 |
| 最近记录: |