找不到名称"PropertyKey" [英] Cannot find name 'PropertyKey'
问题描述
我正在尝试在一个项目上运行Webpack,但出现多个错误
I am trying to run Webpack on a project and I am getting multiple errors
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'.
我应该安装所有类型的输入,因此我不确定这些输入来自何处.我尝试从已编译的项目中复制package.json,但无济于事.我想念什么?
I should have all my typings installed so I am not sure where these are coming from. I tried copying over a package.json from a project that compiles but it didn't help. What am I missing?
我的tsconfig看起来像这样
My tsconfig looks like this
{
"compilerOptions": {
"target": "es5",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules",
"**/*.spec.ts"
]
}
推荐答案
在0.9.35,@ types/core-js出现了同样的错误
I am getting the same kind of errors with @types/core-js at 0.9.35
可能是其他东西.
编辑
上周回购交易发生了一些变化.您可以在github上阅读该问题,并通过以下链接查看更改:
There has been some changes on the repo last week. You can read the issue on github and see the changes via these links:
https://github.com/DefinitelyTyped/DefinitelyTyped/issues/15104
我的解决方案是改变
"lib": ["es5", "dom"]
到"lib": ["es6", "dom"]
.
这样做,我使错误消失而不降级到0.9.35
By doing this I made the errors disappear without downgrading to 0.9.35
注意:您不需要更改目标(我的仍然是es5)
Note: You dont need to change the target (mine is still es5)
这篇关于找不到名称"PropertyKey"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!