Cannot find name 'Set'. Do you need to change your target library? Try changing the `lib`compiler
程序员文章站
2022-03-27 20:44:04
...
错误信息
TS2583: Cannot find name ‘Set’. Do you need to change your target library? Try changing the lib
compiler option to es2015 or later.
错误截图
解决方案:
修改tsconfig.json. 我目前用的版本是"typescript": “^3.7.5”
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"noImplicitAny": true,
"module": "commonjs",
"target": "es6", //把es5改成es6
"jsx": "react"
},
"include": [
"./src/**/*"
]
}
跟着中文文档https://typescript.bootcss.com/学习React与webpack的时候报的错。可能是之前翻译的时候还是旧版本的typescript。升级后就不能编译了。
上一篇: 901. 股票价格跨度
下一篇: 巧用TypeScript