reactjs - 使用redux(mobx)注入的打字稿类型检查反应组件的问题
问题描述
类型检查不适用于由商店注入的导出组件,导出道具接口也不起作用。
interface IProps{
//...types here
}
export class TaskList extends React.Component<IProps, IState> {
//...class content
}
export default compose(withNavigation, inject("store"), observer)(TaskList);
然后在另一个组件中,当我尝试调用时
<TaskList
//...props here
/>
这些道具没有经过类型检查(它们甚至没有出现在 VSCode 的 IntelliSense 上),因为它们位于正常导出的其他组件中。
解决方案
推荐阅读
- java - Java Socket Timeout 虽然我可以通过 Telnet 远程连接
- javascript - HighCharts:显示 3 个 vu-meter
- heroku - 快速简便的方法来查看 heroku 应用程序收到了多少点击?
- python - Pandas - 遍历行并比较以前的值 - 更快
- android-studio - Gradle 5.4.1 解决了我的代理问题。有人可以解释为什么吗?
- cakephp - mysql数据库中的数据类型时间,使用cakephp获取
- c - 为什么我的跨平台 C 应用程序在 Windows 中释放内存时会崩溃?
- css - 如何从文件中加载动态 CSS 变量?
- python - LSTM 仅根据标签和类型预测电影 ID?
- javascript - 如何用JS元素填写VALUE