为什么类型错误阻止UI
该UI均由此黑屏幕显示错误,我想仅在
编译终端中查看类型错误:
我启动了一个使用TypeScript的新创建React应用程序,对于任何类型错误, 45
TS2322:类型“布尔值”不可分配给'字符串'。 8 | 9 |
10 | <路由路径=“/product”元素= {hi}> | ^^ 11 | 12 | </> 13 | );
有什么方法可以解决此问题吗?
I started a new create react app with typescript and for any type error, the ui is covered by this black screen showing errors, i want to see type errors only in terminal
Compiled with problems:X
ERROR in src/App.tsx:10:45
TS2322: Type 'boolean' is not assignable to type 'string'.
8 |
9 |
10 | <Route path="/product" element={hi}>
| ^^
11 |
12 | </>
13 | );
Any way to fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您正在使用Create-React-App,
1-如果您想忽略整个项目。在项目的根部创建一个“ .env”文件,并将这些设置放入其中。
2-如果您只想忽略那条线。在线上方提出了这一评论。
Assuming you are using create-react-app,
1- If you want to ignore for whole project. Create a ".env" file in the root of the project and put inside it these settings.
2-If you want to ignore just that line. Just above the line put this comment.