因为项目更新,代码检查出现【“DatePicker”不能用作 JSX 组件】的提示。
可以运行,但是看起来很难受。
网上找了很多方法。
1.@types\react和ts版本对应不上。在package.json加上如下代码(无效)
"scripts": {
"preinstall": "npx npm-force-resolutions",
....
},
"resolutions": {
"@types/react": "17.0.45"
}
2.删除node_moudles,重新install(无效)
3.清理工作目录中未被 Git 跟踪的文件和目录git clean -dfx 。删除node_moudles,重新install(有效)
git clean -dfx