【问题标题】:Missleading flow type error in react props反应道具中的误导性流类型错误
【发布时间】:2019-02-12 07:27:26
【问题描述】:

使用 react-redux 更改了添加到组件的 DispatchProps 的函数的实现,我收到以下错误:

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].

然而,prop 是DispatchProps 的一部分;与上述道具相交:type Props = ExternalProps &amp; ConnectProps &amp; DispatchProps.

【问题讨论】:

    标签: javascript reactjs redux flowtype


    【解决方案1】:

    问题显然是函数实现中的类型错误。这似乎导致流程没有将函数添加到道具,然后以这种方式抱怨 - 重构函数以在更细粒度级别使用类型使流程正确报告问题。

    【讨论】:

      猜你喜欢
      • 2020-04-08
      • 2017-06-20
      • 2020-10-09
      • 2021-09-12
      • 1970-01-01
      • 2018-11-01
      • 1970-01-01
      • 2022-01-27
      • 2021-09-29
      相关资源
      最近更新 更多