[英]typescript and @types/react errors
I'm still learning to use typescript with react. 我仍在学习使用带有响应的打字稿。 Due to how slow react-scripts-ts was, I was turned off from it.
由于react-scripts-ts的速度很慢,所以我被关闭了。 I've tried the new typescript setup with babel 7 ( react-webpack-typescript-babel ) and its exceedingly fast.
我已经尝试了使用babel 7( react-webpack-typescript-babel )的新打字稿设置,并且安装速度非常快。 However there are some basic errors that I can't resolve.
但是,有些基本错误我无法解决。
Even though the project runs, in vscode I get the following errors: 即使项目正在运行,在vscode中我仍然遇到以下错误:
I'm assuming this is a @types/react and typescript issue. 我假设这是一个@ types / react和typescript问题。
Based on @lleon input, an old typescript version was the cause of my headache. 根据@lleon输入,旧的打字稿版本使我头痛。 I removed it
npm un -g typescript
, added vscode user setting "typescript.tsdk": "node_modules\\\\typescript\\\\lib"
and restarted vscode. 我删除了
npm un -g typescript
typescript,添加了vscode用户设置"typescript.tsdk": "node_modules\\\\typescript\\\\lib"
然后重新启动了vscode。 Works well so far. 到目前为止效果很好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.