0
原谅新手问题,我正在努力通过理解/将flowType集成到我的react/redux项目中。FlowType - 重复复杂对象的声明
我的问题是,当我们声明包含已声明(其他)属性的属性时,我们是否必须重复自己(声明类型)?
详细说明,我有高阶函数,它通过道具进行过滤,以便相关的action-creator
函数被调用相关参数。这是一个HO函数,它将4个对象作为参数。
只关注第一个:envProps
。其代码如下:
type envProps = {
eCCurSelectedEle : string,
renderTab : string,
target : {
pos : string,
// collection is an object containing dynamically
// inserted template objects with sub-objects. How would
// I handle this? Do I have to break-down each object
// property in this 'collection' & declare its inner
// prop types and so on?
collection : Object
},
targetPos : {
h : number,
w : number,
pageX : number,
pageY : number
},
toolbarCtrl : string
};
// just focusing on the first prop: envProps
export const svgMouseDownHandler = (envProps : envProps,
svgProps,
target,
prevSelectedTarget) => {
...
我必须声明每个参数中的每个属性类型,即使该财产已经申报别的地方? 我将如何处理动态对象?
谢谢,