Skip to content

Commit ee4b244

Browse files
committed
Update flow types
1 parent 3cce8c6 commit ee4b244

File tree

2 files changed

+68
-28
lines changed

2 files changed

+68
-28
lines changed

.flowconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ node_modules
44
[include]
55

66
[libs]
7-
flow-typed
8-
custom-types
7+
./flow-typed
8+
./custom-types
99

1010
[lints]
1111

flow-typed/npm/redux_v4.x.x.js

Lines changed: 66 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
// flow-typed signature: df80bdd535bfed9cf3223e077f3b4543
2-
// flow-typed version: c4c8963c9c/redux_v4.x.x/flow_>=v0.55.x
1+
// flow-typed signature: f62df6dbce399d55b0f2954c5ac1bd4e
2+
// flow-typed version: c6154227d1/redux_v4.x.x/flow_>=v0.104.x
33

44
declare module 'redux' {
5-
65
/*
76
87
S = State
@@ -11,49 +10,90 @@ declare module 'redux' {
1110
1211
*/
1312

13+
declare export type Action<T> = { type: T, ... }
14+
1415
declare export type DispatchAPI<A> = (action: A) => A;
15-
declare export type Dispatch<A: { type: $Subtype<string> }> = DispatchAPI<A>;
16+
17+
declare export type Dispatch<A: { type: *, ... }> = DispatchAPI<A>;
1618

1719
declare export type MiddlewareAPI<S, A, D = Dispatch<A>> = {
18-
dispatch: D;
19-
getState(): S;
20+
dispatch: D,
21+
getState(): S,
22+
...
2023
};
2124

2225
declare export type Store<S, A, D = Dispatch<A>> = {
2326
// rewrite MiddlewareAPI members in order to get nicer error messages (intersections produce long messages)
24-
dispatch: D;
25-
getState(): S;
26-
subscribe(listener: () => void): () => void;
27-
replaceReducer(nextReducer: Reducer<S, A>): void
27+
dispatch: D,
28+
getState(): S,
29+
subscribe(listener: () => void): () => void,
30+
replaceReducer(nextReducer: Reducer<S, A>): void,
31+
...
2832
};
2933

3034
declare export type Reducer<S, A> = (state: S | void, action: A) => S;
3135

32-
declare export type CombinedReducer<S, A> = (state: $Shape<S> & {} | void, action: A) => S;
36+
declare export type CombinedReducer<S, A> = (
37+
state: ($Shape<S> & {...}) | void,
38+
action: A
39+
) => S;
3340

34-
declare export type Middleware<S, A, D = Dispatch<A>> =
35-
(api: MiddlewareAPI<S, A, D>) =>
36-
(next: D) => D;
41+
declare export type Middleware<S, A, D = Dispatch<A>> = (
42+
api: MiddlewareAPI<S, A, D>
43+
) => (next: D) => D;
3744

3845
declare export type StoreCreator<S, A, D = Dispatch<A>> = {
39-
(reducer: Reducer<S, A>, enhancer?: StoreEnhancer<S, A, D>): Store<S, A, D>;
40-
(reducer: Reducer<S, A>, preloadedState: S, enhancer?: StoreEnhancer<S, A, D>): Store<S, A, D>;
46+
(reducer: Reducer<S, A>, enhancer?: StoreEnhancer<S, A, D>): Store<S, A, D>,
47+
(
48+
reducer: Reducer<S, A>,
49+
preloadedState: S,
50+
enhancer?: StoreEnhancer<S, A, D>
51+
): Store<S, A, D>,
52+
...
4153
};
4254

43-
declare export type StoreEnhancer<S, A, D = Dispatch<A>> = (next: StoreCreator<S, A, D>) => StoreCreator<S, A, D>;
55+
declare export type StoreEnhancer<S, A, D = Dispatch<A>> = (
56+
next: StoreCreator<S, A, D>
57+
) => StoreCreator<S, A, D>;
4458

45-
declare export function createStore<S, A, D>(reducer: Reducer<S, A>, enhancer?: StoreEnhancer<S, A, D>): Store<S, A, D>;
46-
declare export function createStore<S, A, D>(reducer: Reducer<S, A>, preloadedState?: S, enhancer?: StoreEnhancer<S, A, D>): Store<S, A, D>;
59+
declare export function createStore<S, A, D>(
60+
reducer: Reducer<S, A>,
61+
enhancer?: StoreEnhancer<S, A, D>
62+
): Store<S, A, D>;
63+
declare export function createStore<S, A, D>(
64+
reducer: Reducer<S, A>,
65+
preloadedState?: S,
66+
enhancer?: StoreEnhancer<S, A, D>
67+
): Store<S, A, D>;
4768

48-
declare export function applyMiddleware<S, A, D>(...middlewares: Array<Middleware<S, A, D>>): StoreEnhancer<S, A, D>;
69+
declare export function applyMiddleware<S, A, D>(
70+
...middlewares: Array<Middleware<S, A, D>>
71+
): StoreEnhancer<S, A, D>;
4972

5073
declare export type ActionCreator<A, B> = (...args: Array<B>) => A;
51-
declare export type ActionCreators<K, A> = { [key: K]: ActionCreator<A, any> };
52-
53-
declare export function bindActionCreators<A, C: ActionCreator<A, any>, D: DispatchAPI<A>>(actionCreator: C, dispatch: D): C;
54-
declare export function bindActionCreators<A, K, C: ActionCreators<K, A>, D: DispatchAPI<A>>(actionCreators: C, dispatch: D): C;
55-
56-
declare export function combineReducers<O: Object, A>(reducers: O): CombinedReducer<$ObjMap<O, <S>(r: Reducer<S, any>) => S>, A>;
74+
declare export type ActionCreators<K, A> = { [key: K]: ActionCreator<A, any>, ... };
75+
76+
declare export function bindActionCreators<
77+
A,
78+
C: ActionCreator<A, any>,
79+
D: DispatchAPI<A>
80+
>(
81+
actionCreator: C,
82+
dispatch: D
83+
): C;
84+
declare export function bindActionCreators<
85+
A,
86+
K,
87+
C: ActionCreators<K, A>,
88+
D: DispatchAPI<A>
89+
>(
90+
actionCreators: C,
91+
dispatch: D
92+
): C;
93+
94+
declare export function combineReducers<O: {...}, A>(
95+
reducers: O
96+
): CombinedReducer<$ObjMap<O, <S>(r: Reducer<S, any>) => S>, A>;
5797

5898
declare export var compose: $Compose;
5999
}

0 commit comments

Comments
 (0)