forked from jitsi/jitsi-meet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreact-redux_v5.x.x.js
192 lines (170 loc) · 5.13 KB
/
react-redux_v5.x.x.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
// flow-typed signature: d4e793bc07ef1dc9906a244b12960f7b
// flow-typed version: cf33ff8762/react-redux_v5.x.x/flow_>=v0.63.0
import type { Dispatch, Store } from "redux";
declare module "react-redux" {
import type { ComponentType, ElementConfig } from 'react';
declare export class Provider<S, A> extends React$Component<{
store: Store<S, A>,
children?: any
}> {}
declare export function createProvider(
storeKey?: string,
subKey?: string
): Provider<*, *>;
/*
S = State
A = Action
OP = OwnProps
SP = StateProps
DP = DispatchProps
MP = Merge props
MDP = Map dispatch to props object
RSP = Returned state props
RDP = Returned dispatch props
RMP = Returned merge props
CP = Props for returned component
Com = React Component
*/
declare type MapStateToProps<S: Object, SP: Object, RSP: Object> = (state: S, props: SP) => RSP;
declare type MapDispatchToProps<A, OP: Object, RDP: Object> = (dispatch: Dispatch<A>, ownProps: OP) => RDP;
declare type MergeProps<SP: Object, DP: Object, MP: Object, RMP: Object> = (
stateProps: SP,
dispatchProps: DP,
ownProps: MP
) => RMP;
declare type ConnectOptions<S: Object, OP: Object, RSP: Object, RMP: Object> = {|
pure?: boolean,
withRef?: boolean,
areStatesEqual?: (next: S, prev: S) => boolean,
areOwnPropsEqual?: (next: OP, prev: OP) => boolean,
areStatePropsEqual?: (next: RSP, prev: RSP) => boolean,
areMergedPropsEqual?: (next: RMP, prev: RMP) => boolean,
storeKey?: string
|};
declare type OmitDispatch<Component> = $Diff<Component, {dispatch: Dispatch<*>}>;
declare export function connect<
Com: ComponentType<*>,
S: Object,
DP: Object,
RSP: Object,
CP: $Diff<OmitDispatch<ElementConfig<Com>>, RSP>
>(
mapStateToProps: MapStateToProps<S, DP, RSP>,
mapDispatchToProps?: null
): (component: Com) => ComponentType<CP & DP>;
declare export function connect<Com: ComponentType<*>>(
mapStateToProps?: null,
mapDispatchToProps?: null
): (component: Com) => ComponentType<OmitDispatch<ElementConfig<Com>>>;
declare export function connect<
Com: ComponentType<*>,
A,
S: Object,
DP: Object,
SP: Object,
RSP: Object,
RDP: Object,
CP: $Diff<$Diff<ElementConfig<Com>, RSP>, RDP>
>(
mapStateToProps: MapStateToProps<S, SP, RSP>,
mapDispatchToProps: MapDispatchToProps<A, DP, RDP>
): (component: Com) => ComponentType<CP & SP & DP>;
declare export function connect<
Com: ComponentType<*>,
A,
OP: Object,
DP: Object,
PR: Object,
CP: $Diff<ElementConfig<Com>, DP>
>(
mapStateToProps?: null,
mapDispatchToProps: MapDispatchToProps<A, OP, DP>
): (Com) => ComponentType<CP & OP>;
declare export function connect<
Com: ComponentType<*>,
MDP: Object
>(
mapStateToProps?: null,
mapDispatchToProps: MDP
): (component: Com) => ComponentType<$Diff<ElementConfig<Com>, MDP>>;
declare export function connect<
Com: ComponentType<*>,
S: Object,
SP: Object,
RSP: Object,
MDP: Object,
CP: $Diff<ElementConfig<Com>, RSP>
>(
mapStateToProps: MapStateToProps<S, SP, RSP>,
mapDispatchToPRops: MDP
): (component: Com) => ComponentType<$Diff<CP, MDP> & SP>;
declare export function connect<
Com: ComponentType<*>,
A,
S: Object,
DP: Object,
SP: Object,
RSP: Object,
RDP: Object,
MP: Object,
RMP: Object,
CP: $Diff<ElementConfig<Com>, RMP>
>(
mapStateToProps: MapStateToProps<S, SP, RSP>,
mapDispatchToProps: ?MapDispatchToProps<A, DP, RDP>,
mergeProps: MergeProps<RSP, RDP, MP, RMP>
): (component: Com) => ComponentType<CP & SP & DP & MP>;
declare export function connect<
Com: ComponentType<*>,
A,
S: Object,
DP: Object,
SP: Object,
RSP: Object,
RDP: Object,
MDP: Object,
MP: Object,
RMP: Object,
CP: $Diff<ElementConfig<Com>, RMP>
>(
mapStateToProps: MapStateToProps<S, SP, RSP>,
mapDispatchToProps: MDP,
mergeProps: MergeProps<RSP, RDP, MP, RMP>
): (component: Com) => ComponentType<CP & SP & DP & MP>;
declare export function connect<Com: ComponentType<*>,
A,
S: Object,
DP: Object,
SP: Object,
RSP: Object,
RDP: Object,
MP: Object,
RMP: Object
>(
mapStateToProps: ?MapStateToProps<S, SP, RSP>,
mapDispatchToProps: ?MapDispatchToProps<A, DP, RDP>,
mergeProps: ?MergeProps<RSP, RDP, MP, RMP>,
options: ConnectOptions<S, SP & DP & MP, RSP, RMP>
): (component: Com) => ComponentType<$Diff<ElementConfig<Com>, RMP> & SP & DP & MP>;
declare export function connect<Com: ComponentType<*>,
A,
S: Object,
DP: Object,
SP: Object,
RSP: Object,
RDP: Object,
MDP: Object,
MP: Object,
RMP: Object
>(
mapStateToProps: ?MapStateToProps<S, SP, RSP>,
mapDispatchToProps: ?MapDispatchToProps<A, DP, RDP>,
mergeProps: MDP,
options: ConnectOptions<S, SP & DP & MP, RSP, RMP>
): (component: Com) => ComponentType<$Diff<ElementConfig<Com>, RMP> & SP & DP & MP>;
declare export default {
Provider: typeof Provider,
createProvider: typeof createProvider,
connect: typeof connect,
};
}