简体   繁体   中英

Missleading flow type error in react props

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 .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM