diff options
| author | Andrej Mihajlov <and@codeispoetry.ru> | 2017-07-25 18:29:52 +0100 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2017-07-27 09:52:45 +0100 |
| commit | 3006da543c2db56d6bf512101a422201d85c08e8 (patch) | |
| tree | a4d4adcdefa0ff1be3d36307b6d9f3f85e941f14 | |
| parent | 9ad9fffaf35da36d21959ff5a3acb86adfb59b62 (diff) | |
| download | mullvadvpn-3006da543c2db56d6bf512101a422201d85c08e8.tar.xz mullvadvpn-3006da543c2db56d6bf512101a422201d85c08e8.zip | |
Add new redux annotations
See: https://github.com/flowtype/flow-typed/pull/1071
| -rw-r--r-- | flow-typed/npm/redux_v3.x.x.js | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/flow-typed/npm/redux_v3.x.x.js b/flow-typed/npm/redux_v3.x.x.js index 711e59910f..4f93322f7d 100644 --- a/flow-typed/npm/redux_v3.x.x.js +++ b/flow-typed/npm/redux_v3.x.x.js @@ -1,5 +1,6 @@ -// flow-typed signature: 76c3dfb5a40ce169d5c08fe80dbd029a -// flow-typed version: 37b1c6d953/redux_v3.x.x/flow_>=v0.33.x +// This is a custom implementation of redux flow annotations. +// Please do not overwrite without consideration. +// PR: https://github.com/flowtype/flow-typed/pull/1071 declare module 'redux' { @@ -7,19 +8,20 @@ declare module 'redux' { S = State A = Action + D = Dispatch */ declare type Dispatch<A: { type: $Subtype<string> }> = (action: A) => A; - declare type MiddlewareAPI<S, A> = { - dispatch: Dispatch<A>; + declare type MiddlewareAPI<S, A, D = Dispatch<A>> = { + dispatch: D; getState(): S; }; - declare type Store<S, A> = { + declare type Store<S, A, D = Dispatch<A>> = { // rewrite MiddlewareAPI members in order to get nicer error messages (intersections produce long messages) - dispatch: Dispatch<A>; + dispatch: D; getState(): S; subscribe(listener: () => void): () => void; replaceReducer(nextReducer: Reducer<S, A>): void @@ -29,27 +31,27 @@ declare module 'redux' { 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>; + declare type Middleware<S, A, D = Dispatch<A>> = + (api: MiddlewareAPI<S, A, D>) => + (next: D) => D; - declare type StoreCreator<S, A> = { - (reducer: Reducer<S, A>, enhancer?: StoreEnhancer<S, A>): Store<S, A>; - (reducer: Reducer<S, A>, preloadedState: S, enhancer?: StoreEnhancer<S, A>): Store<S, A>; + declare type StoreCreator<S, A, D = Dispatch<A>> = { + (reducer: Reducer<S, A>, enhancer?: StoreEnhancer<S, A, D>): Store<S, A, D>; + (reducer: Reducer<S, A>, preloadedState: S, enhancer?: StoreEnhancer<S, A, D>): Store<S, A, D>; }; - declare type StoreEnhancer<S, A> = (next: StoreCreator<S, A>) => StoreCreator<S, A>; + declare type StoreEnhancer<S, A, D = Dispatch<A>> = (next: StoreCreator<S, A, D>) => StoreCreator<S, A, D>; - declare function createStore<S, A>(reducer: Reducer<S, A>, enhancer?: StoreEnhancer<S, A>): Store<S, A>; - declare function createStore<S, A>(reducer: Reducer<S, A>, preloadedState: S, enhancer?: StoreEnhancer<S, A>): Store<S, A>; + declare function createStore<S, A, D>(reducer: Reducer<S, A>, enhancer?: StoreEnhancer<S, A, D>): Store<S, A, D>; + declare function createStore<S, A, D>(reducer: Reducer<S, A>, preloadedState: S, enhancer?: StoreEnhancer<S, A, D>): Store<S, A, D>; - declare function applyMiddleware<S, A>(...middlewares: Array<Middleware<S, A>>): StoreEnhancer<S, A>; + declare function applyMiddleware<S, A, D>(...middlewares: Array<Middleware<S, A, D>>): StoreEnhancer<S, A, D>; declare type ActionCreator<A, B> = (...args: Array<B>) => A; declare type ActionCreators<K, A> = { [key: K]: ActionCreator<A, any> }; - 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 bindActionCreators<A, C: ActionCreator<A, any>, D>(actionCreator: C, dispatch: D): C; + declare function bindActionCreators<A, K, C: ActionCreators<K, A>, D>(actionCreators: C, dispatch: D): C; declare function combineReducers<O: Object, A>(reducers: O): CombinedReducer<$ObjMap<O, <S>(r: Reducer<S, any>) => S>, A>; |
