Permalink
Browse files

Update argument type of reducer produced by combineReducers (#2115)

* update argument type of reducer produced by combineReducers

* update Reducer type to use $Shape

* define CombinedReducer type
1 parent c8567dc commit c10866ab3448d2bd9ae781b9785144c706ae296a @nickarora nickarora committed with timdorr Nov 23, 2016
Showing with 3 additions and 1 deletion.
  1. +3 −1 flow-typed/redux.js
View
@@ -24,6 +24,8 @@ declare module 'redux' {
declare type Reducer<S, A> = (state: S, action: A) => S;
+ declare type CombinedReducer<S, A> = (state: $Shape<S> & {} | void, action: A) => S;
+
declare type Middleware<S, A> =
(api: MiddlewareAPI<S, A>) =>
(next: Dispatch<A>) => Dispatch<A>;
@@ -46,7 +48,7 @@ declare module 'redux' {
declare function bindActionCreators<A, C: ActionCreator<A, any>>(actionCreator: C, dispatch: Dispatch<A>): C;
declare function bindActionCreators<A, K, C: ActionCreators<K, A>>(actionCreators: C, dispatch: Dispatch<A>): C;
- declare function combineReducers<O: Object, A>(reducers: O): Reducer<$ObjMap<O, <S>(r: Reducer<S, any>) => S>, A>;
+ declare function combineReducers<O: Object, A>(reducers: O): CombinedReducer<$ObjMap<O, <S>(r: Reducer<S, any>) => S>, A>;
declare function compose<S, A>(...fns: Array<StoreEnhancer<S, A>>): Function;

0 comments on commit c10866a

Please sign in to comment.