isomorfeus-redux 4.2.0 → 22.9.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +176 -0
  3. data/lib/app_state.rb +25 -0
  4. data/lib/isomorfeus/browser_store_api.rb +0 -16
  5. data/lib/isomorfeus/redux/config.rb +97 -14
  6. data/lib/isomorfeus/redux/handler.rb +35 -0
  7. data/lib/isomorfeus/redux/version.rb +5 -0
  8. data/lib/isomorfeus/redux_imports.rb +14 -0
  9. data/lib/{redux/reducers.rb → isomorfeus/redux_reducers.rb} +15 -13
  10. data/lib/isomorfeus-redux.rb +18 -30
  11. data/lib/local_store.rb +27 -30
  12. data/lib/redux/store.rb +156 -120
  13. data/lib/session_store.rb +28 -30
  14. metadata +24 -247
  15. data/lib/app_store.rb +0 -42
  16. data/lib/isomorfeus/core_ext/hash/deep_merge.rb +0 -34
  17. data/lib/isomorfeus/core_ext/kernel.rb +0 -30
  18. data/lib/isomorfeus/execution_environment.rb +0 -67
  19. data/lib/isomorfeus/redux/imports.rb +0 -17
  20. data/lib/redux/version.rb +0 -3
  21. data/lib/redux.rb +0 -118
  22. data/node_modules/.package-lock.json +0 -31
  23. data/node_modules/@babel/runtime/LICENSE +0 -22
  24. data/node_modules/@babel/runtime/README.md +0 -19
  25. data/node_modules/@babel/runtime/helpers/AsyncGenerator.js +0 -99
  26. data/node_modules/@babel/runtime/helpers/AwaitValue.js +0 -6
  27. data/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js +0 -31
  28. data/node_modules/@babel/runtime/helpers/arrayLikeToArray.js +0 -12
  29. data/node_modules/@babel/runtime/helpers/arrayWithHoles.js +0 -6
  30. data/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js +0 -8
  31. data/node_modules/@babel/runtime/helpers/assertThisInitialized.js +0 -10
  32. data/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js +0 -57
  33. data/node_modules/@babel/runtime/helpers/asyncIterator.js +0 -16
  34. data/node_modules/@babel/runtime/helpers/asyncToGenerator.js +0 -38
  35. data/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js +0 -8
  36. data/node_modules/@babel/runtime/helpers/checkPrivateRedeclaration.js +0 -8
  37. data/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js +0 -23
  38. data/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js +0 -10
  39. data/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js +0 -14
  40. data/node_modules/@babel/runtime/helpers/classCallCheck.js +0 -8
  41. data/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js +0 -8
  42. data/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js +0 -8
  43. data/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js +0 -10
  44. data/node_modules/@babel/runtime/helpers/classNameTDZError.js +0 -6
  45. data/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js +0 -11
  46. data/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js +0 -11
  47. data/node_modules/@babel/runtime/helpers/classPrivateFieldInitSpec.js +0 -9
  48. data/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js +0 -10
  49. data/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js +0 -8
  50. data/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js +0 -12
  51. data/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js +0 -10
  52. data/node_modules/@babel/runtime/helpers/classPrivateMethodInitSpec.js +0 -9
  53. data/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js +0 -6
  54. data/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js +0 -14
  55. data/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js +0 -14
  56. data/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js +0 -15
  57. data/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js +0 -9
  58. data/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js +0 -6
  59. data/node_modules/@babel/runtime/helpers/construct.js +0 -26
  60. data/node_modules/@babel/runtime/helpers/createClass.js +0 -18
  61. data/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js +0 -61
  62. data/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js +0 -25
  63. data/node_modules/@babel/runtime/helpers/createSuper.js +0 -25
  64. data/node_modules/@babel/runtime/helpers/decorate.js +0 -401
  65. data/node_modules/@babel/runtime/helpers/defaults.js +0 -17
  66. data/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js +0 -25
  67. data/node_modules/@babel/runtime/helpers/defineProperty.js +0 -17
  68. data/node_modules/@babel/runtime/helpers/esm/AsyncGenerator.js +0 -95
  69. data/node_modules/@babel/runtime/helpers/esm/AwaitValue.js +0 -3
  70. data/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js +0 -28
  71. data/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +0 -9
  72. data/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +0 -3
  73. data/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js +0 -4
  74. data/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +0 -7
  75. data/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js +0 -54
  76. data/node_modules/@babel/runtime/helpers/esm/asyncIterator.js +0 -13
  77. data/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js +0 -35
  78. data/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js +0 -4
  79. data/node_modules/@babel/runtime/helpers/esm/checkPrivateRedeclaration.js +0 -5
  80. data/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js +0 -20
  81. data/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js +0 -7
  82. data/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js +0 -11
  83. data/node_modules/@babel/runtime/helpers/esm/classCallCheck.js +0 -5
  84. data/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js +0 -5
  85. data/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js +0 -5
  86. data/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js +0 -7
  87. data/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js +0 -3
  88. data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js +0 -6
  89. data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js +0 -6
  90. data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldInitSpec.js +0 -5
  91. data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js +0 -7
  92. data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js +0 -4
  93. data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js +0 -7
  94. data/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js +0 -7
  95. data/node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js +0 -5
  96. data/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js +0 -3
  97. data/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js +0 -8
  98. data/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js +0 -8
  99. data/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js +0 -9
  100. data/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js +0 -5
  101. data/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js +0 -3
  102. data/node_modules/@babel/runtime/helpers/esm/construct.js +0 -18
  103. data/node_modules/@babel/runtime/helpers/esm/createClass.js +0 -15
  104. data/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js +0 -57
  105. data/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js +0 -21
  106. data/node_modules/@babel/runtime/helpers/esm/createSuper.js +0 -19
  107. data/node_modules/@babel/runtime/helpers/esm/decorate.js +0 -396
  108. data/node_modules/@babel/runtime/helpers/esm/defaults.js +0 -14
  109. data/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js +0 -22
  110. data/node_modules/@babel/runtime/helpers/esm/defineProperty.js +0 -14
  111. data/node_modules/@babel/runtime/helpers/esm/extends.js +0 -17
  112. data/node_modules/@babel/runtime/helpers/esm/get.js +0 -20
  113. data/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js +0 -6
  114. data/node_modules/@babel/runtime/helpers/esm/inherits.js +0 -15
  115. data/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +0 -6
  116. data/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js +0 -9
  117. data/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js +0 -3
  118. data/node_modules/@babel/runtime/helpers/esm/instanceof.js +0 -7
  119. data/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js +0 -5
  120. data/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js +0 -51
  121. data/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js +0 -3
  122. data/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js +0 -12
  123. data/node_modules/@babel/runtime/helpers/esm/iterableToArray.js +0 -3
  124. data/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js +0 -29
  125. data/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimitLoose.js +0 -14
  126. data/node_modules/@babel/runtime/helpers/esm/jsx.js +0 -46
  127. data/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js +0 -9
  128. data/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js +0 -5
  129. data/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +0 -3
  130. data/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js +0 -3
  131. data/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js +0 -3
  132. data/node_modules/@babel/runtime/helpers/esm/objectSpread.js +0 -19
  133. data/node_modules/@babel/runtime/helpers/esm/objectSpread2.js +0 -39
  134. data/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js +0 -19
  135. data/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +0 -14
  136. data/node_modules/@babel/runtime/helpers/esm/package.json +0 -3
  137. data/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js +0 -11
  138. data/node_modules/@babel/runtime/helpers/esm/readOnlyError.js +0 -3
  139. data/node_modules/@babel/runtime/helpers/esm/set.js +0 -51
  140. data/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +0 -8
  141. data/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js +0 -7
  142. data/node_modules/@babel/runtime/helpers/esm/slicedToArray.js +0 -7
  143. data/node_modules/@babel/runtime/helpers/esm/slicedToArrayLoose.js +0 -7
  144. data/node_modules/@babel/runtime/helpers/esm/superPropBase.js +0 -9
  145. data/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js +0 -11
  146. data/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js +0 -8
  147. data/node_modules/@babel/runtime/helpers/esm/tdz.js +0 -3
  148. data/node_modules/@babel/runtime/helpers/esm/temporalRef.js +0 -5
  149. data/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js +0 -1
  150. data/node_modules/@babel/runtime/helpers/esm/toArray.js +0 -7
  151. data/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js +0 -7
  152. data/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +0 -13
  153. data/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +0 -6
  154. data/node_modules/@babel/runtime/helpers/esm/typeof.js +0 -15
  155. data/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +0 -9
  156. data/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js +0 -6
  157. data/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js +0 -37
  158. data/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js +0 -65
  159. data/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js +0 -3
  160. data/node_modules/@babel/runtime/helpers/extends.js +0 -21
  161. data/node_modules/@babel/runtime/helpers/get.js +0 -27
  162. data/node_modules/@babel/runtime/helpers/getPrototypeOf.js +0 -10
  163. data/node_modules/@babel/runtime/helpers/inherits.js +0 -19
  164. data/node_modules/@babel/runtime/helpers/inheritsLoose.js +0 -10
  165. data/node_modules/@babel/runtime/helpers/initializerDefineProperty.js +0 -12
  166. data/node_modules/@babel/runtime/helpers/initializerWarningHelper.js +0 -6
  167. data/node_modules/@babel/runtime/helpers/instanceof.js +0 -10
  168. data/node_modules/@babel/runtime/helpers/interopRequireDefault.js +0 -8
  169. data/node_modules/@babel/runtime/helpers/interopRequireWildcard.js +0 -54
  170. data/node_modules/@babel/runtime/helpers/isNativeFunction.js +0 -6
  171. data/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js +0 -15
  172. data/node_modules/@babel/runtime/helpers/iterableToArray.js +0 -6
  173. data/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js +0 -32
  174. data/node_modules/@babel/runtime/helpers/iterableToArrayLimitLoose.js +0 -17
  175. data/node_modules/@babel/runtime/helpers/jsx.js +0 -50
  176. data/node_modules/@babel/runtime/helpers/maybeArrayLike.js +0 -13
  177. data/node_modules/@babel/runtime/helpers/newArrowCheck.js +0 -8
  178. data/node_modules/@babel/runtime/helpers/nonIterableRest.js +0 -6
  179. data/node_modules/@babel/runtime/helpers/nonIterableSpread.js +0 -6
  180. data/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js +0 -6
  181. data/node_modules/@babel/runtime/helpers/objectSpread.js +0 -23
  182. data/node_modules/@babel/runtime/helpers/objectSpread2.js +0 -42
  183. data/node_modules/@babel/runtime/helpers/objectWithoutProperties.js +0 -23
  184. data/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js +0 -17
  185. data/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js +0 -16
  186. data/node_modules/@babel/runtime/helpers/readOnlyError.js +0 -6
  187. data/node_modules/@babel/runtime/helpers/set.js +0 -55
  188. data/node_modules/@babel/runtime/helpers/setPrototypeOf.js +0 -12
  189. data/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js +0 -10
  190. data/node_modules/@babel/runtime/helpers/slicedToArray.js +0 -14
  191. data/node_modules/@babel/runtime/helpers/slicedToArrayLoose.js +0 -14
  192. data/node_modules/@babel/runtime/helpers/superPropBase.js +0 -13
  193. data/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js +0 -14
  194. data/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js +0 -11
  195. data/node_modules/@babel/runtime/helpers/tdz.js +0 -6
  196. data/node_modules/@babel/runtime/helpers/temporalRef.js +0 -10
  197. data/node_modules/@babel/runtime/helpers/temporalUndefined.js +0 -4
  198. data/node_modules/@babel/runtime/helpers/toArray.js +0 -14
  199. data/node_modules/@babel/runtime/helpers/toConsumableArray.js +0 -14
  200. data/node_modules/@babel/runtime/helpers/toPrimitive.js +0 -17
  201. data/node_modules/@babel/runtime/helpers/toPropertyKey.js +0 -11
  202. data/node_modules/@babel/runtime/helpers/typeof.js +0 -22
  203. data/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js +0 -13
  204. data/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js +0 -10
  205. data/node_modules/@babel/runtime/helpers/wrapNativeSuper.js +0 -45
  206. data/node_modules/@babel/runtime/helpers/wrapRegExp.js +0 -72
  207. data/node_modules/@babel/runtime/helpers/writeOnlyError.js +0 -6
  208. data/node_modules/@babel/runtime/package.json +0 -848
  209. data/node_modules/@babel/runtime/regenerator/index.js +0 -1
  210. data/node_modules/redux/LICENSE.md +0 -21
  211. data/node_modules/redux/README.md +0 -322
  212. data/node_modules/redux/dist/redux.js +0 -768
  213. data/node_modules/redux/dist/redux.min.js +0 -1
  214. data/node_modules/redux/es/redux.js +0 -716
  215. data/node_modules/redux/es/redux.mjs +0 -1
  216. data/node_modules/redux/index.d.ts +0 -776
  217. data/node_modules/redux/lib/redux.js +0 -730
  218. data/node_modules/redux/package.json +0 -108
  219. data/node_modules/redux/src/applyMiddleware.js +0 -41
  220. data/node_modules/redux/src/bindActionCreators.js +0 -52
  221. data/node_modules/redux/src/combineReducers.js +0 -175
  222. data/node_modules/redux/src/compose.js +0 -22
  223. data/node_modules/redux/src/createStore.js +0 -347
  224. data/node_modules/redux/src/index.js +0 -37
  225. data/node_modules/redux/src/utils/actionTypes.js +0 -17
  226. data/node_modules/redux/src/utils/formatProdErrorMessage.js +0 -15
  227. data/node_modules/redux/src/utils/isPlainObject.js +0 -14
  228. data/node_modules/redux/src/utils/kindOf.js +0 -70
  229. data/node_modules/redux/src/utils/symbol-observable.js +0 -3
  230. data/node_modules/redux/src/utils/warning.js +0 -19
  231. data/node_modules/regenerator-runtime/LICENSE +0 -21
  232. data/node_modules/regenerator-runtime/README.md +0 -31
  233. data/node_modules/regenerator-runtime/package.json +0 -19
  234. data/node_modules/regenerator-runtime/path.js +0 -11
  235. data/node_modules/regenerator-runtime/runtime.js +0 -754
  236. data/package.json +0 -6
@@ -1,776 +0,0 @@
1
- /**
2
- * An *action* is a plain object that represents an intention to change the
3
- * state. Actions are the only way to get data into the store. Any data,
4
- * whether from UI events, network callbacks, or other sources such as
5
- * WebSockets needs to eventually be dispatched as actions.
6
- *
7
- * Actions must have a `type` field that indicates the type of action being
8
- * performed. Types can be defined as constants and imported from another
9
- * module. It's better to use strings for `type` than Symbols because strings
10
- * are serializable.
11
- *
12
- * Other than `type`, the structure of an action object is really up to you.
13
- * If you're interested, check out Flux Standard Action for recommendations on
14
- * how actions should be constructed.
15
- *
16
- * @template T the type of the action's `type` tag.
17
- */
18
- export interface Action<T = any> {
19
- type: T
20
- }
21
-
22
- /**
23
- * An Action type which accepts any other properties.
24
- * This is mainly for the use of the `Reducer` type.
25
- * This is not part of `Action` itself to prevent types that extend `Action` from
26
- * having an index signature.
27
- */
28
- export interface AnyAction extends Action {
29
- // Allows any extra properties to be defined in an action.
30
- [extraProps: string]: any
31
- }
32
-
33
- /**
34
- * Internal "virtual" symbol used to make the `CombinedState` type unique.
35
- */
36
- declare const $CombinedState: unique symbol
37
-
38
- /**
39
- * State base type for reducers created with `combineReducers()`.
40
- *
41
- * This type allows the `createStore()` method to infer which levels of the
42
- * preloaded state can be partial.
43
- *
44
- * Because Typescript is really duck-typed, a type needs to have some
45
- * identifying property to differentiate it from other types with matching
46
- * prototypes for type checking purposes. That's why this type has the
47
- * `$CombinedState` symbol property. Without the property, this type would
48
- * match any object. The symbol doesn't really exist because it's an internal
49
- * (i.e. not exported), and internally we never check its value. Since it's a
50
- * symbol property, it's not expected to be unumerable, and the value is
51
- * typed as always undefined, so its never expected to have a meaningful
52
- * value anyway. It just makes this type distinquishable from plain `{}`.
53
- */
54
- interface EmptyObject {
55
- readonly [$CombinedState]?: undefined
56
- }
57
- export type CombinedState<S> = EmptyObject & S
58
-
59
- /**
60
- * Recursively makes combined state objects partial. Only combined state _root
61
- * objects_ (i.e. the generated higher level object with keys mapping to
62
- * individual reducers) are partial.
63
- */
64
- export type PreloadedState<S> = Required<S> extends EmptyObject
65
- ? S extends CombinedState<infer S1>
66
- ? {
67
- [K in keyof S1]?: S1[K] extends object ? PreloadedState<S1[K]> : S1[K]
68
- }
69
- : S
70
- : {
71
- [K in keyof S]: S[K] extends string | number | boolean | symbol
72
- ? S[K]
73
- : PreloadedState<S[K]>
74
- }
75
-
76
- /* reducers */
77
-
78
- /**
79
- * A *reducer* (also called a *reducing function*) is a function that accepts
80
- * an accumulation and a value and returns a new accumulation. They are used
81
- * to reduce a collection of values down to a single value
82
- *
83
- * Reducers are not unique to Redux—they are a fundamental concept in
84
- * functional programming. Even most non-functional languages, like
85
- * JavaScript, have a built-in API for reducing. In JavaScript, it's
86
- * `Array.prototype.reduce()`.
87
- *
88
- * In Redux, the accumulated value is the state object, and the values being
89
- * accumulated are actions. Reducers calculate a new state given the previous
90
- * state and an action. They must be *pure functions*—functions that return
91
- * the exact same output for given inputs. They should also be free of
92
- * side-effects. This is what enables exciting features like hot reloading and
93
- * time travel.
94
- *
95
- * Reducers are the most important concept in Redux.
96
- *
97
- * *Do not put API calls into reducers.*
98
- *
99
- * @template S The type of state consumed and produced by this reducer.
100
- * @template A The type of actions the reducer can potentially respond to.
101
- */
102
- export type Reducer<S = any, A extends Action = AnyAction> = (
103
- state: S | undefined,
104
- action: A
105
- ) => S
106
-
107
- /**
108
- * Object whose values correspond to different reducer functions.
109
- *
110
- * @template A The type of actions the reducers can potentially respond to.
111
- */
112
- export type ReducersMapObject<S = any, A extends Action = Action> = {
113
- [K in keyof S]: Reducer<S[K], A>
114
- }
115
-
116
- /**
117
- * Infer a combined state shape from a `ReducersMapObject`.
118
- *
119
- * @template M Object map of reducers as provided to `combineReducers(map: M)`.
120
- */
121
- export type StateFromReducersMapObject<M> = M extends ReducersMapObject<
122
- any,
123
- any
124
- >
125
- ? { [P in keyof M]: M[P] extends Reducer<infer S, any> ? S : never }
126
- : never
127
-
128
- /**
129
- * Infer reducer union type from a `ReducersMapObject`.
130
- *
131
- * @template M Object map of reducers as provided to `combineReducers(map: M)`.
132
- */
133
- export type ReducerFromReducersMapObject<M> = M extends {
134
- [P in keyof M]: infer R
135
- }
136
- ? R extends Reducer<any, any>
137
- ? R
138
- : never
139
- : never
140
-
141
- /**
142
- * Infer action type from a reducer function.
143
- *
144
- * @template R Type of reducer.
145
- */
146
- export type ActionFromReducer<R> = R extends Reducer<any, infer A> ? A : never
147
-
148
- /**
149
- * Infer action union type from a `ReducersMapObject`.
150
- *
151
- * @template M Object map of reducers as provided to `combineReducers(map: M)`.
152
- */
153
- export type ActionFromReducersMapObject<M> = M extends ReducersMapObject<
154
- any,
155
- any
156
- >
157
- ? ActionFromReducer<ReducerFromReducersMapObject<M>>
158
- : never
159
-
160
- /**
161
- * Turns an object whose values are different reducer functions, into a single
162
- * reducer function. It will call every child reducer, and gather their results
163
- * into a single state object, whose keys correspond to the keys of the passed
164
- * reducer functions.
165
- *
166
- * @template S Combined state object type.
167
- *
168
- * @param reducers An object whose values correspond to different reducer
169
- * functions that need to be combined into one. One handy way to obtain it
170
- * is to use ES6 `import * as reducers` syntax. The reducers may never
171
- * return undefined for any action. Instead, they should return their
172
- * initial state if the state passed to them was undefined, and the current
173
- * state for any unrecognized action.
174
- *
175
- * @returns A reducer function that invokes every reducer inside the passed
176
- * object, and builds a state object with the same shape.
177
- */
178
- export function combineReducers<S>(
179
- reducers: ReducersMapObject<S, any>
180
- ): Reducer<CombinedState<S>>
181
- export function combineReducers<S, A extends Action = AnyAction>(
182
- reducers: ReducersMapObject<S, A>
183
- ): Reducer<CombinedState<S>, A>
184
- export function combineReducers<M extends ReducersMapObject<any, any>>(
185
- reducers: M
186
- ): Reducer<
187
- CombinedState<StateFromReducersMapObject<M>>,
188
- ActionFromReducersMapObject<M>
189
- >
190
-
191
- /* store */
192
-
193
- /**
194
- * A *dispatching function* (or simply *dispatch function*) is a function that
195
- * accepts an action or an async action; it then may or may not dispatch one
196
- * or more actions to the store.
197
- *
198
- * We must distinguish between dispatching functions in general and the base
199
- * `dispatch` function provided by the store instance without any middleware.
200
- *
201
- * The base dispatch function *always* synchronously sends an action to the
202
- * store's reducer, along with the previous state returned by the store, to
203
- * calculate a new state. It expects actions to be plain objects ready to be
204
- * consumed by the reducer.
205
- *
206
- * Middleware wraps the base dispatch function. It allows the dispatch
207
- * function to handle async actions in addition to actions. Middleware may
208
- * transform, delay, ignore, or otherwise interpret actions or async actions
209
- * before passing them to the next middleware.
210
- *
211
- * @template A The type of things (actions or otherwise) which may be
212
- * dispatched.
213
- */
214
- export interface Dispatch<A extends Action = AnyAction> {
215
- <T extends A>(action: T): T
216
- }
217
-
218
- /**
219
- * Function to remove listener added by `Store.subscribe()`.
220
- */
221
- export interface Unsubscribe {
222
- (): void
223
- }
224
-
225
- declare global {
226
- interface SymbolConstructor {
227
- readonly observable: symbol
228
- }
229
- }
230
-
231
- /**
232
- * A minimal observable of state changes.
233
- * For more information, see the observable proposal:
234
- * https://github.com/tc39/proposal-observable
235
- */
236
- export type Observable<T> = {
237
- /**
238
- * The minimal observable subscription method.
239
- * @param {Object} observer Any object that can be used as an observer.
240
- * The observer object should have a `next` method.
241
- * @returns {subscription} An object with an `unsubscribe` method that can
242
- * be used to unsubscribe the observable from the store, and prevent further
243
- * emission of values from the observable.
244
- */
245
- subscribe: (observer: Observer<T>) => { unsubscribe: Unsubscribe }
246
- [Symbol.observable](): Observable<T>
247
- }
248
-
249
- /**
250
- * An Observer is used to receive data from an Observable, and is supplied as
251
- * an argument to subscribe.
252
- */
253
- export type Observer<T> = {
254
- next?(value: T): void
255
- }
256
-
257
- /**
258
- * A store is an object that holds the application's state tree.
259
- * There should only be a single store in a Redux app, as the composition
260
- * happens on the reducer level.
261
- *
262
- * @template S The type of state held by this store.
263
- * @template A the type of actions which may be dispatched by this store.
264
- */
265
- export interface Store<S = any, A extends Action = AnyAction> {
266
- /**
267
- * Dispatches an action. It is the only way to trigger a state change.
268
- *
269
- * The `reducer` function, used to create the store, will be called with the
270
- * current state tree and the given `action`. Its return value will be
271
- * considered the **next** state of the tree, and the change listeners will
272
- * be notified.
273
- *
274
- * The base implementation only supports plain object actions. If you want
275
- * to dispatch a Promise, an Observable, a thunk, or something else, you
276
- * need to wrap your store creating function into the corresponding
277
- * middleware. For example, see the documentation for the `redux-thunk`
278
- * package. Even the middleware will eventually dispatch plain object
279
- * actions using this method.
280
- *
281
- * @param action A plain object representing “what changed”. It is a good
282
- * idea to keep actions serializable so you can record and replay user
283
- * sessions, or use the time travelling `redux-devtools`. An action must
284
- * have a `type` property which may not be `undefined`. It is a good idea
285
- * to use string constants for action types.
286
- *
287
- * @returns For convenience, the same action object you dispatched.
288
- *
289
- * Note that, if you use a custom middleware, it may wrap `dispatch()` to
290
- * return something else (for example, a Promise you can await).
291
- */
292
- dispatch: Dispatch<A>
293
-
294
- /**
295
- * Reads the state tree managed by the store.
296
- *
297
- * @returns The current state tree of your application.
298
- */
299
- getState(): S
300
-
301
- /**
302
- * Adds a change listener. It will be called any time an action is
303
- * dispatched, and some part of the state tree may potentially have changed.
304
- * You may then call `getState()` to read the current state tree inside the
305
- * callback.
306
- *
307
- * You may call `dispatch()` from a change listener, with the following
308
- * caveats:
309
- *
310
- * 1. The subscriptions are snapshotted just before every `dispatch()` call.
311
- * If you subscribe or unsubscribe while the listeners are being invoked,
312
- * this will not have any effect on the `dispatch()` that is currently in
313
- * progress. However, the next `dispatch()` call, whether nested or not,
314
- * will use a more recent snapshot of the subscription list.
315
- *
316
- * 2. The listener should not expect to see all states changes, as the state
317
- * might have been updated multiple times during a nested `dispatch()` before
318
- * the listener is called. It is, however, guaranteed that all subscribers
319
- * registered before the `dispatch()` started will be called with the latest
320
- * state by the time it exits.
321
- *
322
- * @param listener A callback to be invoked on every dispatch.
323
- * @returns A function to remove this change listener.
324
- */
325
- subscribe(listener: () => void): Unsubscribe
326
-
327
- /**
328
- * Replaces the reducer currently used by the store to calculate the state.
329
- *
330
- * You might need this if your app implements code splitting and you want to
331
- * load some of the reducers dynamically. You might also need this if you
332
- * implement a hot reloading mechanism for Redux.
333
- *
334
- * @param nextReducer The reducer for the store to use instead.
335
- */
336
- replaceReducer(nextReducer: Reducer<S, A>): void
337
-
338
- /**
339
- * Interoperability point for observable/reactive libraries.
340
- * @returns {observable} A minimal observable of state changes.
341
- * For more information, see the observable proposal:
342
- * https://github.com/tc39/proposal-observable
343
- */
344
- [Symbol.observable](): Observable<S>
345
- }
346
-
347
- export type DeepPartial<T> = {
348
- [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K]
349
- }
350
-
351
- /**
352
- * A store creator is a function that creates a Redux store. Like with
353
- * dispatching function, we must distinguish the base store creator,
354
- * `createStore(reducer, preloadedState)` exported from the Redux package, from
355
- * store creators that are returned from the store enhancers.
356
- *
357
- * @template S The type of state to be held by the store.
358
- * @template A The type of actions which may be dispatched.
359
- * @template Ext Store extension that is mixed in to the Store type.
360
- * @template StateExt State extension that is mixed into the state type.
361
- */
362
- export interface StoreCreator {
363
- <S, A extends Action, Ext, StateExt>(
364
- reducer: Reducer<S, A>,
365
- enhancer?: StoreEnhancer<Ext, StateExt>
366
- ): Store<S & StateExt, A> & Ext
367
- <S, A extends Action, Ext, StateExt>(
368
- reducer: Reducer<S, A>,
369
- preloadedState?: PreloadedState<S>,
370
- enhancer?: StoreEnhancer<Ext>
371
- ): Store<S & StateExt, A> & Ext
372
- }
373
-
374
- /**
375
- * @deprecated
376
- *
377
- * **We recommend using the `configureStore` method
378
- * of the `@reduxjs/toolkit` package**, which replaces `createStore`.
379
- *
380
- * Redux Toolkit is our recommended approach for writing Redux logic today,
381
- * including store setup, reducers, data fetching, and more.
382
- *
383
- * **For more details, please read this Redux docs page:**
384
- * **https://redux.js.org/introduction/why-rtk-is-redux-today**
385
- *
386
- * `configureStore` from Redux Toolkit is an improved version of `createStore` that
387
- * simplifies setup and helps avoid common bugs.
388
- *
389
- * You should not be using the `redux` core package by itself today, except for learning purposes.
390
- * The `createStore` method from the core `redux` package will not be removed, but we encourage
391
- * all users to migrate to using Redux Toolkit for all Redux code.
392
- *
393
- * If you want to use `createStore` without this visual deprecation warning, use
394
- * the `legacy_createStore` import instead:
395
- *
396
- * `import { legacy_createStore as createStore} from 'redux'`
397
- *
398
- */
399
- export declare function createStore<S, A extends Action, Ext, StateExt>(
400
- reducer: Reducer<S, A>,
401
- enhancer?: StoreEnhancer<Ext, StateExt>
402
- ): Store<S & StateExt, A> & Ext
403
- /**
404
- * @deprecated
405
- *
406
- * **We recommend using the `configureStore` method
407
- * of the `@reduxjs/toolkit` package**, which replaces `createStore`.
408
- *
409
- * Redux Toolkit is our recommended approach for writing Redux logic today,
410
- * including store setup, reducers, data fetching, and more.
411
- *
412
- * **For more details, please read this Redux docs page:**
413
- * **https://redux.js.org/introduction/why-rtk-is-redux-today**
414
- *
415
- * `configureStore` from Redux Toolkit is an improved version of `createStore` that
416
- * simplifies setup and helps avoid common bugs.
417
- *
418
- * You should not be using the `redux` core package by itself today, except for learning purposes.
419
- * The `createStore` method from the core `redux` package will not be removed, but we encourage
420
- * all users to migrate to using Redux Toolkit for all Redux code.
421
- *
422
- * If you want to use `createStore` without this visual deprecation warning, use
423
- * the `legacy_createStore` import instead:
424
- *
425
- * `import { legacy_createStore as createStore} from 'redux'`
426
- *
427
- */
428
- export declare function createStore<S, A extends Action, Ext, StateExt>(
429
- reducer: Reducer<S, A>,
430
- preloadedState?: PreloadedState<S>,
431
- enhancer?: StoreEnhancer<Ext>
432
- ): Store<S & StateExt, A> & Ext
433
-
434
- /**
435
- * Creates a Redux store that holds the state tree.
436
- *
437
- * **We recommend using `configureStore` from the
438
- * `@reduxjs/toolkit` package**, which replaces `createStore`:
439
- * **https://redux.js.org/introduction/why-rtk-is-redux-today**
440
- *
441
- * The only way to change the data in the store is to call `dispatch()` on it.
442
- *
443
- * There should only be a single store in your app. To specify how different
444
- * parts of the state tree respond to actions, you may combine several reducers
445
- * into a single reducer function by using `combineReducers`.
446
- *
447
- * @param {Function} reducer A function that returns the next state tree, given
448
- * the current state tree and the action to handle.
449
- *
450
- * @param {any} [preloadedState] The initial state. You may optionally specify it
451
- * to hydrate the state from the server in universal apps, or to restore a
452
- * previously serialized user session.
453
- * If you use `combineReducers` to produce the root reducer function, this must be
454
- * an object with the same shape as `combineReducers` keys.
455
- *
456
- * @param {Function} [enhancer] The store enhancer. You may optionally specify it
457
- * to enhance the store with third-party capabilities such as middleware,
458
- * time travel, persistence, etc. The only store enhancer that ships with Redux
459
- * is `applyMiddleware()`.
460
- *
461
- * @returns {Store} A Redux store that lets you read the state, dispatch actions
462
- * and subscribe to changes.
463
- */
464
- export declare function legacy_createStore<S, A extends Action, Ext, StateExt>(
465
- reducer: Reducer<S, A>,
466
- enhancer?: StoreEnhancer<Ext, StateExt>
467
- ): Store<S & StateExt, A> & Ext
468
- /**
469
- * Creates a Redux store that holds the state tree.
470
- *
471
- * **We recommend using `configureStore` from the
472
- * `@reduxjs/toolkit` package**, which replaces `createStore`:
473
- * **https://redux.js.org/introduction/why-rtk-is-redux-today**
474
- *
475
- * The only way to change the data in the store is to call `dispatch()` on it.
476
- *
477
- * There should only be a single store in your app. To specify how different
478
- * parts of the state tree respond to actions, you may combine several reducers
479
- * into a single reducer function by using `combineReducers`.
480
- *
481
- * @param {Function} reducer A function that returns the next state tree, given
482
- * the current state tree and the action to handle.
483
- *
484
- * @param {any} [preloadedState] The initial state. You may optionally specify it
485
- * to hydrate the state from the server in universal apps, or to restore a
486
- * previously serialized user session.
487
- * If you use `combineReducers` to produce the root reducer function, this must be
488
- * an object with the same shape as `combineReducers` keys.
489
- *
490
- * @param {Function} [enhancer] The store enhancer. You may optionally specify it
491
- * to enhance the store with third-party capabilities such as middleware,
492
- * time travel, persistence, etc. The only store enhancer that ships with Redux
493
- * is `applyMiddleware()`.
494
- *
495
- * @returns {Store} A Redux store that lets you read the state, dispatch actions
496
- * and subscribe to changes.
497
- */
498
- export declare function legacy_createStore<S, A extends Action, Ext, StateExt>(
499
- reducer: Reducer<S, A>,
500
- preloadedState?: PreloadedState<S>,
501
- enhancer?: StoreEnhancer<Ext>
502
- ): Store<S & StateExt, A> & Ext
503
-
504
- /**
505
- * A store enhancer is a higher-order function that composes a store creator
506
- * to return a new, enhanced store creator. This is similar to middleware in
507
- * that it allows you to alter the store interface in a composable way.
508
- *
509
- * Store enhancers are much the same concept as higher-order components in
510
- * React, which are also occasionally called “component enhancers”.
511
- *
512
- * Because a store is not an instance, but rather a plain-object collection of
513
- * functions, copies can be easily created and modified without mutating the
514
- * original store. There is an example in `compose` documentation
515
- * demonstrating that.
516
- *
517
- * Most likely you'll never write a store enhancer, but you may use the one
518
- * provided by the developer tools. It is what makes time travel possible
519
- * without the app being aware it is happening. Amusingly, the Redux
520
- * middleware implementation is itself a store enhancer.
521
- *
522
- * @template Ext Store extension that is mixed into the Store type.
523
- * @template StateExt State extension that is mixed into the state type.
524
- */
525
- export type StoreEnhancer<Ext = {}, StateExt = {}> = (
526
- next: StoreEnhancerStoreCreator
527
- ) => StoreEnhancerStoreCreator<Ext, StateExt>
528
- export type StoreEnhancerStoreCreator<Ext = {}, StateExt = {}> = <
529
- S = any,
530
- A extends Action = AnyAction
531
- >(
532
- reducer: Reducer<S, A>,
533
- preloadedState?: PreloadedState<S>
534
- ) => Store<S & StateExt, A> & Ext
535
-
536
- /* middleware */
537
-
538
- export interface MiddlewareAPI<D extends Dispatch = Dispatch, S = any> {
539
- dispatch: D
540
- getState(): S
541
- }
542
-
543
- /**
544
- * A middleware is a higher-order function that composes a dispatch function
545
- * to return a new dispatch function. It often turns async actions into
546
- * actions.
547
- *
548
- * Middleware is composable using function composition. It is useful for
549
- * logging actions, performing side effects like routing, or turning an
550
- * asynchronous API call into a series of synchronous actions.
551
- *
552
- * @template DispatchExt Extra Dispatch signature added by this middleware.
553
- * @template S The type of the state supported by this middleware.
554
- * @template D The type of Dispatch of the store where this middleware is
555
- * installed.
556
- */
557
- export interface Middleware<
558
- DispatchExt = {},
559
- S = any,
560
- D extends Dispatch = Dispatch
561
- > {
562
- (api: MiddlewareAPI<D, S>): (
563
- next: Dispatch<AnyAction>
564
- ) => (action: any) => any
565
- }
566
-
567
- /**
568
- * Creates a store enhancer that applies middleware to the dispatch method
569
- * of the Redux store. This is handy for a variety of tasks, such as
570
- * expressing asynchronous actions in a concise manner, or logging every
571
- * action payload.
572
- *
573
- * See `redux-thunk` package as an example of the Redux middleware.
574
- *
575
- * Because middleware is potentially asynchronous, this should be the first
576
- * store enhancer in the composition chain.
577
- *
578
- * Note that each middleware will be given the `dispatch` and `getState`
579
- * functions as named arguments.
580
- *
581
- * @param middlewares The middleware chain to be applied.
582
- * @returns A store enhancer applying the middleware.
583
- *
584
- * @template Ext Dispatch signature added by a middleware.
585
- * @template S The type of the state supported by a middleware.
586
- */
587
- export function applyMiddleware(): StoreEnhancer
588
- export function applyMiddleware<Ext1, S>(
589
- middleware1: Middleware<Ext1, S, any>
590
- ): StoreEnhancer<{ dispatch: Ext1 }>
591
- export function applyMiddleware<Ext1, Ext2, S>(
592
- middleware1: Middleware<Ext1, S, any>,
593
- middleware2: Middleware<Ext2, S, any>
594
- ): StoreEnhancer<{ dispatch: Ext1 & Ext2 }>
595
- export function applyMiddleware<Ext1, Ext2, Ext3, S>(
596
- middleware1: Middleware<Ext1, S, any>,
597
- middleware2: Middleware<Ext2, S, any>,
598
- middleware3: Middleware<Ext3, S, any>
599
- ): StoreEnhancer<{ dispatch: Ext1 & Ext2 & Ext3 }>
600
- export function applyMiddleware<Ext1, Ext2, Ext3, Ext4, S>(
601
- middleware1: Middleware<Ext1, S, any>,
602
- middleware2: Middleware<Ext2, S, any>,
603
- middleware3: Middleware<Ext3, S, any>,
604
- middleware4: Middleware<Ext4, S, any>
605
- ): StoreEnhancer<{ dispatch: Ext1 & Ext2 & Ext3 & Ext4 }>
606
- export function applyMiddleware<Ext1, Ext2, Ext3, Ext4, Ext5, S>(
607
- middleware1: Middleware<Ext1, S, any>,
608
- middleware2: Middleware<Ext2, S, any>,
609
- middleware3: Middleware<Ext3, S, any>,
610
- middleware4: Middleware<Ext4, S, any>,
611
- middleware5: Middleware<Ext5, S, any>
612
- ): StoreEnhancer<{ dispatch: Ext1 & Ext2 & Ext3 & Ext4 & Ext5 }>
613
- export function applyMiddleware<Ext, S = any>(
614
- ...middlewares: Middleware<any, S, any>[]
615
- ): StoreEnhancer<{ dispatch: Ext }>
616
-
617
- /* action creators */
618
-
619
- /**
620
- * An *action creator* is, quite simply, a function that creates an action. Do
621
- * not confuse the two terms—again, an action is a payload of information, and
622
- * an action creator is a factory that creates an action.
623
- *
624
- * Calling an action creator only produces an action, but does not dispatch
625
- * it. You need to call the store's `dispatch` function to actually cause the
626
- * mutation. Sometimes we say *bound action creators* to mean functions that
627
- * call an action creator and immediately dispatch its result to a specific
628
- * store instance.
629
- *
630
- * If an action creator needs to read the current state, perform an API call,
631
- * or cause a side effect, like a routing transition, it should return an
632
- * async action instead of an action.
633
- *
634
- * @template A Returned action type.
635
- */
636
- export interface ActionCreator<A> {
637
- (...args: any[]): A
638
- }
639
-
640
- /**
641
- * Object whose values are action creator functions.
642
- */
643
- export interface ActionCreatorsMapObject<A = any> {
644
- [key: string]: ActionCreator<A>
645
- }
646
-
647
- /**
648
- * Turns an object whose values are action creators, into an object with the
649
- * same keys, but with every function wrapped into a `dispatch` call so they
650
- * may be invoked directly. This is just a convenience method, as you can call
651
- * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.
652
- *
653
- * For convenience, you can also pass a single function as the first argument,
654
- * and get a function in return.
655
- *
656
- * @param actionCreator An object whose values are action creator functions.
657
- * One handy way to obtain it is to use ES6 `import * as` syntax. You may
658
- * also pass a single function.
659
- *
660
- * @param dispatch The `dispatch` function available on your Redux store.
661
- *
662
- * @returns The object mimicking the original object, but with every action
663
- * creator wrapped into the `dispatch` call. If you passed a function as
664
- * `actionCreator`, the return value will also be a single function.
665
- */
666
- export function bindActionCreators<A, C extends ActionCreator<A>>(
667
- actionCreator: C,
668
- dispatch: Dispatch
669
- ): C
670
-
671
- export function bindActionCreators<
672
- A extends ActionCreator<any>,
673
- B extends ActionCreator<any>
674
- >(actionCreator: A, dispatch: Dispatch): B
675
-
676
- export function bindActionCreators<A, M extends ActionCreatorsMapObject<A>>(
677
- actionCreators: M,
678
- dispatch: Dispatch
679
- ): M
680
-
681
- export function bindActionCreators<
682
- M extends ActionCreatorsMapObject<any>,
683
- N extends ActionCreatorsMapObject<any>
684
- >(actionCreators: M, dispatch: Dispatch): N
685
-
686
- /* compose */
687
-
688
- type Func0<R> = () => R
689
- type Func1<T1, R> = (a1: T1) => R
690
- type Func2<T1, T2, R> = (a1: T1, a2: T2) => R
691
- type Func3<T1, T2, T3, R> = (a1: T1, a2: T2, a3: T3, ...args: any[]) => R
692
-
693
- /**
694
- * Composes single-argument functions from right to left. The rightmost
695
- * function can take multiple arguments as it provides the signature for the
696
- * resulting composite function.
697
- *
698
- * @param funcs The functions to compose.
699
- * @returns R function obtained by composing the argument functions from right
700
- * to left. For example, `compose(f, g, h)` is identical to doing
701
- * `(...args) => f(g(h(...args)))`.
702
- */
703
- export function compose(): <R>(a: R) => R
704
-
705
- export function compose<F extends Function>(f: F): F
706
-
707
- /* two functions */
708
- export function compose<A, R>(f1: (b: A) => R, f2: Func0<A>): Func0<R>
709
- export function compose<A, T1, R>(
710
- f1: (b: A) => R,
711
- f2: Func1<T1, A>
712
- ): Func1<T1, R>
713
- export function compose<A, T1, T2, R>(
714
- f1: (b: A) => R,
715
- f2: Func2<T1, T2, A>
716
- ): Func2<T1, T2, R>
717
- export function compose<A, T1, T2, T3, R>(
718
- f1: (b: A) => R,
719
- f2: Func3<T1, T2, T3, A>
720
- ): Func3<T1, T2, T3, R>
721
-
722
- /* three functions */
723
- export function compose<A, B, R>(
724
- f1: (b: B) => R,
725
- f2: (a: A) => B,
726
- f3: Func0<A>
727
- ): Func0<R>
728
- export function compose<A, B, T1, R>(
729
- f1: (b: B) => R,
730
- f2: (a: A) => B,
731
- f3: Func1<T1, A>
732
- ): Func1<T1, R>
733
- export function compose<A, B, T1, T2, R>(
734
- f1: (b: B) => R,
735
- f2: (a: A) => B,
736
- f3: Func2<T1, T2, A>
737
- ): Func2<T1, T2, R>
738
- export function compose<A, B, T1, T2, T3, R>(
739
- f1: (b: B) => R,
740
- f2: (a: A) => B,
741
- f3: Func3<T1, T2, T3, A>
742
- ): Func3<T1, T2, T3, R>
743
-
744
- /* four functions */
745
- export function compose<A, B, C, R>(
746
- f1: (b: C) => R,
747
- f2: (a: B) => C,
748
- f3: (a: A) => B,
749
- f4: Func0<A>
750
- ): Func0<R>
751
- export function compose<A, B, C, T1, R>(
752
- f1: (b: C) => R,
753
- f2: (a: B) => C,
754
- f3: (a: A) => B,
755
- f4: Func1<T1, A>
756
- ): Func1<T1, R>
757
- export function compose<A, B, C, T1, T2, R>(
758
- f1: (b: C) => R,
759
- f2: (a: B) => C,
760
- f3: (a: A) => B,
761
- f4: Func2<T1, T2, A>
762
- ): Func2<T1, T2, R>
763
- export function compose<A, B, C, T1, T2, T3, R>(
764
- f1: (b: C) => R,
765
- f2: (a: B) => C,
766
- f3: (a: A) => B,
767
- f4: Func3<T1, T2, T3, A>
768
- ): Func3<T1, T2, T3, R>
769
-
770
- /* rest */
771
- export function compose<R>(
772
- f1: (b: any) => R,
773
- ...funcs: Function[]
774
- ): (...args: any[]) => R
775
-
776
- export function compose<R>(...funcs: Function[]): (...args: any[]) => R