【发布时间】:2019-02-24 00:25:32
【问题描述】:
我想使用 redux 中的 combineReducers 函数。 但是我收到以下错误消息:
Missing type annotation for `A`. `A` is a type parameter declared in function type [1] and was implicitly instantiated
at call of `combineReducers` [2].
src/reducer/index.js:12:16
12| export default combineReducers({ message })
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2]
References:
flow-typed/npm/redux_v4.x.x.js:56:42
56| declare export function combineReducers<O: Object, A>(reducers: O): CombinedReducer<$ObjMap<O, <S>(r: Reducer<S, any>) => S>, A>;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1]
我的 reducer 只是一个获取状态和动作并返回的函数 一个新的状态。
然后我只是在reducer上调用combineReducers,如错误消息所示。
有人知道解决此问题的简单方法吗?
【问题讨论】: