【问题标题】:Better type annotations for function props with flow具有流的功能道具的更好类型注释
【发布时间】:2017-09-06 23:27:22
【问题描述】:

我对组件有以下类型定义:

type Props = {
  address: {
    addressIndex: number,
    entryState: string
  },
  changeEntryState: Function,
  change: Function,
  untouch: Function,
  clearApplicantFields: Function
};

功能非常通用,有什么我可以做的更具体的吗?

它们都是redux动作,changeuntouch来自redux-form

【问题讨论】:

    标签: reactjs redux flowtype


    【解决方案1】:

    例如

    changeEntryState: (val: string) => number
    

    changeEntryState: (str: string, bool?: boolean, ...nums: Array<number>) => void
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-19
      • 2019-01-27
      • 2016-10-26
      • 2017-11-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-02
      相关资源
      最近更新 更多