Missleading flow type error in react props

三世轮回 提交于 2019-12-25 03:40:11

问题


Having changed the implementation of a function added to the DispatchProps of a component using react-redux I got the following error:

yarn run v1.13.0
$ flow

Cannot call this.props.<prop> because:
 • Either property <prop> is missing in ExternalProps [1].
 • Or property <prop> is missing in ConnectProps [2].

However, the prop was part of the DispatchProps; which is intersected with the mentioned props: type Props = ExternalProps & ConnectProps & DispatchProps.


回答1:


The issue was apparently a type-error in the implementation of the function. This seems to lead to flow not adding the function to the props and then complaining in this way - refactoring the function to use types at a more granular level had flow reporting the issue correctly.



来源:https://stackoverflow.com/questions/54644817/missleading-flow-type-error-in-react-props

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!