我想通过添加flow type
重新引用我的方法。我的实际代码:
const apiActions = {
registerThroughApi: async (
state: Object,
action: Function,
formData: Object
): Object => {
return state;
}
};
是否可以添加flow type
?
type Form = {
state: Object,
action: Function,
formData: Object
}
const apiActions = {
registerThroughApi: async (state, action, formData)<Form>: Object => {
return state;
}
};
但是此代码不起作用:D
有人知道这是否可能吗?
谢谢社区!
答案 0 :(得分:0)
不确定我是否完全理解,但是这样的事情
// @flow
const apiActions = {
registerThroughApi: async (state: Object, action: Function, formData: Object): Object => {
return state;
}
};