【问题标题】:Flowtype immutable js map never produces a flow errorFlowtype不可变js映射永远不会产生流错误
【发布时间】:2018-01-19 09:04:00
【问题描述】:

我无法将此 immutablejs 映射到错误:

const alertModal: Map<AlertModalState> = Map(
  {
    'isAlertModalOpen': false,
    'alertModalTitle': '',
    'alertModalMessage': '',
    'height': 0,
    'hasYesNo': false
  }
)

type AlertModalState =  {
  isAlertModalOpen: boolean,
  alertModalTitle: string,
  alertModalMessage: string,
  height: number,
  hasYesNo: boolean
}

当我将属性更改为不同的名称时,它们仍然不会产生流错误。这段代码有效还是应该产生错误?

【问题讨论】:

标签: javascript flowtype immutable.js


【解决方案1】:

这可能会有所帮助:How to describe Immutable.js Map shape with Flow

Immutable 确实有一个带有形状的“地图”类型

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-05-08
    • 1970-01-01
    • 2019-12-13
    • 2017-04-25
    • 1970-01-01
    • 1970-01-01
    • 2017-03-21
    相关资源
    最近更新 更多