react-redux.d.ts 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. import * as React$1 from 'react';
  2. import { Context, ComponentType, ComponentClass, ClassAttributes, JSX, FunctionComponent, ReactNode } from 'react';
  3. import { Action, UnknownAction, Store, Dispatch } from 'redux';
  4. type VoidFunc = () => void;
  5. type Listener = {
  6. callback: VoidFunc;
  7. next: Listener | null;
  8. prev: Listener | null;
  9. };
  10. declare function createListenerCollection(): {
  11. clear(): void;
  12. notify(): void;
  13. get(): Listener[];
  14. subscribe(callback: () => void): () => void;
  15. };
  16. type ListenerCollection = ReturnType<typeof createListenerCollection>;
  17. interface Subscription {
  18. addNestedSub: (listener: VoidFunc) => VoidFunc;
  19. notifyNestedSubs: VoidFunc;
  20. handleChangeWrapper: VoidFunc;
  21. isSubscribed: () => boolean;
  22. onStateChange?: VoidFunc | null;
  23. trySubscribe: VoidFunc;
  24. tryUnsubscribe: VoidFunc;
  25. getListeners: () => ListenerCollection;
  26. }
  27. interface ReactReduxContextValue<SS = any, A extends Action<string> = UnknownAction> extends Pick<ProviderProps, 'stabilityCheck' | 'identityFunctionCheck'> {
  28. store: Store<SS, A>;
  29. subscription: Subscription;
  30. getServerState?: () => SS;
  31. }
  32. declare const ReactReduxContext: Context<ReactReduxContextValue<any, UnknownAction> | null>;
  33. type ReactReduxContextInstance = typeof ReactReduxContext;
  34. /**
  35. * Copyright 2015, Yahoo! Inc.
  36. * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
  37. */
  38. declare const REACT_STATICS: {
  39. readonly childContextTypes: true;
  40. readonly contextType: true;
  41. readonly contextTypes: true;
  42. readonly defaultProps: true;
  43. readonly displayName: true;
  44. readonly getDefaultProps: true;
  45. readonly getDerivedStateFromError: true;
  46. readonly getDerivedStateFromProps: true;
  47. readonly mixins: true;
  48. readonly propTypes: true;
  49. readonly type: true;
  50. };
  51. declare const KNOWN_STATICS: {
  52. readonly name: true;
  53. readonly length: true;
  54. readonly prototype: true;
  55. readonly caller: true;
  56. readonly callee: true;
  57. readonly arguments: true;
  58. readonly arity: true;
  59. };
  60. declare const FORWARD_REF_STATICS: {
  61. readonly $$typeof: true;
  62. readonly render: true;
  63. readonly defaultProps: true;
  64. readonly displayName: true;
  65. readonly propTypes: true;
  66. };
  67. declare const MEMO_STATICS: {
  68. readonly $$typeof: true;
  69. readonly compare: true;
  70. readonly defaultProps: true;
  71. readonly displayName: true;
  72. readonly propTypes: true;
  73. readonly type: true;
  74. };
  75. type NonReactStatics<S extends React$1.ComponentType<any>, C extends {
  76. [key: string]: true;
  77. } = {}> = {
  78. [key in Exclude<keyof S, S extends React$1.MemoExoticComponent<any> ? keyof typeof MEMO_STATICS | keyof C : S extends React$1.ForwardRefExoticComponent<any> ? keyof typeof FORWARD_REF_STATICS | keyof C : keyof typeof REACT_STATICS | keyof typeof KNOWN_STATICS | keyof C>]: S[key];
  79. };
  80. type SelectorFactory<S, TProps, TOwnProps, TFactoryOptions> = (dispatch: Dispatch<Action<string>>, factoryOptions: TFactoryOptions) => Selector<S, TProps, TOwnProps>;
  81. type Selector<S, TProps, TOwnProps = null> = TOwnProps extends null | undefined ? (state: S) => TProps : (state: S, ownProps: TOwnProps) => TProps;
  82. type MapStateToProps<TStateProps, TOwnProps, State> = (state: State, ownProps: TOwnProps) => TStateProps;
  83. type MapStateToPropsFactory<TStateProps, TOwnProps, State> = (initialState: State, ownProps: TOwnProps) => MapStateToProps<TStateProps, TOwnProps, State>;
  84. type MapStateToPropsParam<TStateProps, TOwnProps, State> = MapStateToPropsFactory<TStateProps, TOwnProps, State> | MapStateToProps<TStateProps, TOwnProps, State> | null | undefined;
  85. type MapDispatchToPropsFunction<TDispatchProps, TOwnProps> = (dispatch: Dispatch<Action<string>>, ownProps: TOwnProps) => TDispatchProps;
  86. type MapDispatchToProps<TDispatchProps, TOwnProps> = MapDispatchToPropsFunction<TDispatchProps, TOwnProps> | TDispatchProps;
  87. type MapDispatchToPropsFactory<TDispatchProps, TOwnProps> = (dispatch: Dispatch<Action<string>>, ownProps: TOwnProps) => MapDispatchToPropsFunction<TDispatchProps, TOwnProps>;
  88. type MapDispatchToPropsParam<TDispatchProps, TOwnProps> = MapDispatchToPropsFactory<TDispatchProps, TOwnProps> | MapDispatchToProps<TDispatchProps, TOwnProps>;
  89. type MapDispatchToPropsNonObject<TDispatchProps, TOwnProps> = MapDispatchToPropsFactory<TDispatchProps, TOwnProps> | MapDispatchToPropsFunction<TDispatchProps, TOwnProps>;
  90. type MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps> = (stateProps: TStateProps, dispatchProps: TDispatchProps, ownProps: TOwnProps) => TMergedProps;
  91. interface ConnectProps {
  92. /** A custom Context instance that the component can use to access the store from an alternate Provider using that same Context instance */
  93. context?: ReactReduxContextInstance;
  94. /** A Redux store instance to be used for subscriptions instead of the store from a Provider */
  95. store?: Store;
  96. }
  97. /**
  98. * Infers the type of props that a connector will inject into a component.
  99. */
  100. type ConnectedProps<TConnector> = TConnector extends InferableComponentEnhancerWithProps<infer TInjectedProps, any> ? unknown extends TInjectedProps ? TConnector extends InferableComponentEnhancer<infer TInjectedProps> ? TInjectedProps : never : TInjectedProps : never;
  101. interface ConnectOptions<State = unknown, TStateProps = {}, TOwnProps = {}, TMergedProps = {}> {
  102. forwardRef?: boolean;
  103. context?: typeof ReactReduxContext;
  104. areStatesEqual?: (nextState: State, prevState: State, nextOwnProps: TOwnProps, prevOwnProps: TOwnProps) => boolean;
  105. areOwnPropsEqual?: (nextOwnProps: TOwnProps, prevOwnProps: TOwnProps) => boolean;
  106. areStatePropsEqual?: (nextStateProps: TStateProps, prevStateProps: TStateProps) => boolean;
  107. areMergedPropsEqual?: (nextMergedProps: TMergedProps, prevMergedProps: TMergedProps) => boolean;
  108. }
  109. /**
  110. * Connects a React component to a Redux store.
  111. *
  112. * - Without arguments, just wraps the component, without changing the behavior / props
  113. *
  114. * - If 2 params are passed (3rd param, mergeProps, is skipped), default behavior
  115. * is to override ownProps (as stated in the docs), so what remains is everything that's
  116. * not a state or dispatch prop
  117. *
  118. * - When 3rd param is passed, we don't know if ownProps propagate and whether they
  119. * should be valid component props, because it depends on mergeProps implementation.
  120. * As such, it is the user's responsibility to extend ownProps interface from state or
  121. * dispatch props or both when applicable
  122. *
  123. * @param mapStateToProps
  124. * @param mapDispatchToProps
  125. * @param mergeProps
  126. * @param options
  127. */
  128. interface Connect<DefaultState = unknown> {
  129. (): InferableComponentEnhancer<DispatchProp>;
  130. /** mapState only */
  131. <TStateProps = {}, no_dispatch = {}, TOwnProps = {}, State = DefaultState>(mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>): InferableComponentEnhancerWithProps<TStateProps & DispatchProp, TOwnProps>;
  132. /** mapDispatch only (as a function) */
  133. <no_state = {}, TDispatchProps = {}, TOwnProps = {}>(mapStateToProps: null | undefined, mapDispatchToProps: MapDispatchToPropsNonObject<TDispatchProps, TOwnProps>): InferableComponentEnhancerWithProps<TDispatchProps, TOwnProps>;
  134. /** mapDispatch only (as an object) */
  135. <no_state = {}, TDispatchProps = {}, TOwnProps = {}>(mapStateToProps: null | undefined, mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>): InferableComponentEnhancerWithProps<ResolveThunks<TDispatchProps>, TOwnProps>;
  136. /** mapState and mapDispatch (as a function)*/
  137. <TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, State = DefaultState>(mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>, mapDispatchToProps: MapDispatchToPropsNonObject<TDispatchProps, TOwnProps>): InferableComponentEnhancerWithProps<TStateProps & TDispatchProps, TOwnProps>;
  138. /** mapState and mapDispatch (nullish) */
  139. <TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, State = DefaultState>(mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>, mapDispatchToProps: null | undefined): InferableComponentEnhancerWithProps<TStateProps, TOwnProps>;
  140. /** mapState and mapDispatch (as an object) */
  141. <TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, State = DefaultState>(mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>, mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>): InferableComponentEnhancerWithProps<TStateProps & ResolveThunks<TDispatchProps>, TOwnProps>;
  142. /** mergeProps only */
  143. <no_state = {}, no_dispatch = {}, TOwnProps = {}, TMergedProps = {}>(mapStateToProps: null | undefined, mapDispatchToProps: null | undefined, mergeProps: MergeProps<undefined, DispatchProp, TOwnProps, TMergedProps>): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>;
  144. /** mapState and mergeProps */
  145. <TStateProps = {}, no_dispatch = {}, TOwnProps = {}, TMergedProps = {}, State = DefaultState>(mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>, mapDispatchToProps: null | undefined, mergeProps: MergeProps<TStateProps, DispatchProp, TOwnProps, TMergedProps>): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>;
  146. /** mapDispatch (as a object) and mergeProps */
  147. <no_state = {}, TDispatchProps = {}, TOwnProps = {}, TMergedProps = {}>(mapStateToProps: null | undefined, mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>, mergeProps: MergeProps<undefined, TDispatchProps, TOwnProps, TMergedProps>): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>;
  148. /** mapState and options */
  149. <TStateProps = {}, no_dispatch = {}, TOwnProps = {}, State = DefaultState>(mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>, mapDispatchToProps: null | undefined, mergeProps: null | undefined, options: ConnectOptions<State, TStateProps, TOwnProps>): InferableComponentEnhancerWithProps<DispatchProp & TStateProps, TOwnProps>;
  150. /** mapDispatch (as a function) and options */
  151. <TStateProps = {}, TDispatchProps = {}, TOwnProps = {}>(mapStateToProps: null | undefined, mapDispatchToProps: MapDispatchToPropsNonObject<TDispatchProps, TOwnProps>, mergeProps: null | undefined, options: ConnectOptions<{}, TStateProps, TOwnProps>): InferableComponentEnhancerWithProps<TDispatchProps, TOwnProps>;
  152. /** mapDispatch (as an object) and options*/
  153. <TStateProps = {}, TDispatchProps = {}, TOwnProps = {}>(mapStateToProps: null | undefined, mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>, mergeProps: null | undefined, options: ConnectOptions<{}, TStateProps, TOwnProps>): InferableComponentEnhancerWithProps<ResolveThunks<TDispatchProps>, TOwnProps>;
  154. /** mapState, mapDispatch (as a function), and options */
  155. <TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, State = DefaultState>(mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>, mapDispatchToProps: MapDispatchToPropsNonObject<TDispatchProps, TOwnProps>, mergeProps: null | undefined, options: ConnectOptions<State, TStateProps, TOwnProps>): InferableComponentEnhancerWithProps<TStateProps & TDispatchProps, TOwnProps>;
  156. /** mapState, mapDispatch (as an object), and options */
  157. <TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, State = DefaultState>(mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>, mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>, mergeProps: null | undefined, options: ConnectOptions<State, TStateProps, TOwnProps>): InferableComponentEnhancerWithProps<TStateProps & ResolveThunks<TDispatchProps>, TOwnProps>;
  158. /** mapState, mapDispatch, mergeProps, and options */
  159. <TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, TMergedProps = {}, State = DefaultState>(mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>, mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>, mergeProps: MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>, options?: ConnectOptions<State, TStateProps, TOwnProps, TMergedProps>): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>;
  160. }
  161. declare const _default: Connect<unknown>;
  162. type FixTypeLater = any;
  163. type EqualityFn<T> = (a: T, b: T) => boolean;
  164. type ExtendedEqualityFn<T, P> = (a: T, b: T, c: P, d: P) => boolean;
  165. type AnyIfEmpty<T extends object> = keyof T extends never ? any : T;
  166. type DistributiveOmit<T, K extends keyof T> = T extends unknown ? Omit<T, K> : never;
  167. interface DispatchProp<A extends Action<string> = UnknownAction> {
  168. dispatch: Dispatch<A>;
  169. }
  170. /**
  171. * A property P will be present if:
  172. * - it is present in DecorationTargetProps
  173. *
  174. * Its value will be dependent on the following conditions
  175. * - if property P is present in InjectedProps and its definition extends the definition
  176. * in DecorationTargetProps, then its definition will be that of DecorationTargetProps[P]
  177. * - if property P is not present in InjectedProps then its definition will be that of
  178. * DecorationTargetProps[P]
  179. * - if property P is present in InjectedProps but does not extend the
  180. * DecorationTargetProps[P] definition, its definition will be that of InjectedProps[P]
  181. */
  182. type Matching<InjectedProps, DecorationTargetProps> = {
  183. [P in keyof DecorationTargetProps]: P extends keyof InjectedProps ? InjectedProps[P] extends DecorationTargetProps[P] ? DecorationTargetProps[P] : InjectedProps[P] : DecorationTargetProps[P];
  184. };
  185. /**
  186. * a property P will be present if :
  187. * - it is present in both DecorationTargetProps and InjectedProps
  188. * - InjectedProps[P] can satisfy DecorationTargetProps[P]
  189. * ie: decorated component can accept more types than decorator is injecting
  190. *
  191. * For decoration, inject props or ownProps are all optionally
  192. * required by the decorated (right hand side) component.
  193. * But any property required by the decorated component must be satisfied by the injected property.
  194. */
  195. type Shared<InjectedProps, DecorationTargetProps> = {
  196. [P in Extract<keyof InjectedProps, keyof DecorationTargetProps>]?: InjectedProps[P] extends DecorationTargetProps[P] ? DecorationTargetProps[P] : never;
  197. };
  198. type GetProps<C> = C extends ComponentType<infer P> ? C extends ComponentClass<P> ? ClassAttributes<InstanceType<C>> & P : P : never;
  199. type GetLibraryManagedProps<C> = JSX.LibraryManagedAttributes<C, GetProps<C>>;
  200. type ConnectedComponent<C extends ComponentType<any>, P> = FunctionComponent<P> & NonReactStatics<C> & {
  201. WrappedComponent: C;
  202. };
  203. type ConnectPropsMaybeWithoutContext<TActualOwnProps> = TActualOwnProps extends {
  204. context: any;
  205. } ? Omit<ConnectProps, 'context'> : ConnectProps;
  206. type Identity<T> = T;
  207. type Mapped<T> = Identity<{
  208. [k in keyof T]: T[k];
  209. }>;
  210. type InferableComponentEnhancerWithProps<TInjectedProps, TNeedsProps> = <C extends ComponentType<Matching<TInjectedProps, GetProps<C>>>>(component: C) => ConnectedComponent<C, Mapped<DistributiveOmit<GetLibraryManagedProps<C>, keyof Shared<TInjectedProps, GetLibraryManagedProps<C>>> & TNeedsProps & ConnectPropsMaybeWithoutContext<TNeedsProps & GetProps<C>>>>;
  211. type InferableComponentEnhancer<TInjectedProps> = InferableComponentEnhancerWithProps<TInjectedProps, {}>;
  212. type InferThunkActionCreatorType<TActionCreator extends (...args: any[]) => any> = TActionCreator extends (...args: infer TParams) => (...args: any[]) => infer TReturn ? (...args: TParams) => TReturn : TActionCreator;
  213. type HandleThunkActionCreator<TActionCreator> = TActionCreator extends (...args: any[]) => any ? InferThunkActionCreatorType<TActionCreator> : TActionCreator;
  214. type ResolveThunks<TDispatchProps> = TDispatchProps extends {
  215. [key: string]: any;
  216. } ? {
  217. [C in keyof TDispatchProps]: HandleThunkActionCreator<TDispatchProps[C]>;
  218. } : TDispatchProps;
  219. /**
  220. * This interface allows you to easily create a hook that is properly typed for your
  221. * store's root state.
  222. *
  223. * @example
  224. *
  225. * interface RootState {
  226. * property: string;
  227. * }
  228. *
  229. * const useTypedSelector: TypedUseSelectorHook<RootState> = useSelector;
  230. */
  231. interface TypedUseSelectorHook<TState> {
  232. <TSelected>(selector: (state: TState) => TSelected, equalityFn?: EqualityFn<NoInfer<TSelected>>): TSelected;
  233. <Selected = unknown>(selector: (state: TState) => Selected, options?: UseSelectorOptions<Selected>): Selected;
  234. }
  235. type NoInfer<T> = [T][T extends any ? 0 : never];
  236. /**
  237. * The frequency of development mode checks.
  238. *
  239. * @since 8.1.0
  240. * @internal
  241. */
  242. type DevModeCheckFrequency = 'never' | 'once' | 'always';
  243. /**
  244. * Represents the configuration for development mode checks.
  245. *
  246. * @since 9.0.0
  247. * @internal
  248. */
  249. interface DevModeChecks {
  250. /**
  251. * Overrides the global stability check for the selector.
  252. * - `once` - Run only the first time the selector is called.
  253. * - `always` - Run every time the selector is called.
  254. * - `never` - Never run the stability check.
  255. *
  256. * @default 'once'
  257. *
  258. * @since 8.1.0
  259. */
  260. stabilityCheck: DevModeCheckFrequency;
  261. /**
  262. * Overrides the global identity function check for the selector.
  263. * - `once` - Run only the first time the selector is called.
  264. * - `always` - Run every time the selector is called.
  265. * - `never` - Never run the identity function check.
  266. *
  267. * **Note**: Previously referred to as `noopCheck`.
  268. *
  269. * @default 'once'
  270. *
  271. * @since 9.0.0
  272. */
  273. identityFunctionCheck: DevModeCheckFrequency;
  274. }
  275. interface UseSelectorOptions<Selected = unknown> {
  276. equalityFn?: EqualityFn<Selected>;
  277. /**
  278. * `useSelector` performs additional checks in development mode to help
  279. * identify and warn about potential issues in selector behavior. This
  280. * option allows you to customize the behavior of these checks per selector.
  281. *
  282. * @since 9.0.0
  283. */
  284. devModeChecks?: Partial<DevModeChecks>;
  285. }
  286. interface UseSelector {
  287. <TState = unknown, Selected = unknown>(selector: (state: TState) => Selected, equalityFn?: EqualityFn<Selected>): Selected;
  288. <TState = unknown, Selected = unknown>(selector: (state: TState) => Selected, options?: UseSelectorOptions<Selected>): Selected;
  289. }
  290. /**
  291. * Hook factory, which creates a `useSelector` hook bound to a given context.
  292. *
  293. * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
  294. * @returns {Function} A `useSelector` hook bound to the specified context.
  295. */
  296. declare function createSelectorHook(context?: React.Context<ReactReduxContextValue<any, any> | null>): UseSelector;
  297. /**
  298. * A hook to access the redux store's state. This hook takes a selector function
  299. * as an argument. The selector is called with the store state.
  300. *
  301. * This hook takes an optional equality comparison function as the second parameter
  302. * that allows you to customize the way the selected state is compared to determine
  303. * whether the component needs to be re-rendered.
  304. *
  305. * @param {Function} selector the selector function
  306. * @param {Function=} equalityFn the function that will be used to determine equality
  307. *
  308. * @returns {any} the selected state
  309. *
  310. * @example
  311. *
  312. * import React from 'react'
  313. * import { useSelector } from 'react-redux'
  314. *
  315. * export const CounterComponent = () => {
  316. * const counter = useSelector(state => state.counter)
  317. * return <div>{counter}</div>
  318. * }
  319. */
  320. declare const useSelector: UseSelector;
  321. interface ProviderProps<A extends Action<string> = UnknownAction, S = unknown> {
  322. /**
  323. * The single Redux store in your application.
  324. */
  325. store: Store<S, A>;
  326. /**
  327. * An optional server state snapshot. Will be used during initial hydration render if available, to ensure that the UI output is consistent with the HTML generated on the server.
  328. */
  329. serverState?: S;
  330. /**
  331. * Optional context to be used internally in react-redux. Use React.createContext() to create a context to be used.
  332. * If this is used, you'll need to customize `connect` by supplying the same context provided to the Provider.
  333. * Set the initial value to null, and the hooks will error
  334. * if this is not overwritten by Provider.
  335. */
  336. context?: Context<ReactReduxContextValue<S, A> | null>;
  337. /**
  338. * Determines the frequency of stability checks for all selectors.
  339. * This setting overrides the global configuration for
  340. * the `useSelector` stability check, allowing you to specify how often
  341. * these checks should occur in development mode.
  342. *
  343. * @since 8.1.0
  344. */
  345. stabilityCheck?: DevModeCheckFrequency;
  346. /**
  347. * Determines the frequency of identity function checks for all selectors.
  348. * This setting overrides the global configuration for
  349. * the `useSelector` identity function check, allowing you to specify how often
  350. * these checks should occur in development mode.
  351. *
  352. * **Note**: Previously referred to as `noopCheck`.
  353. *
  354. * @since 9.0.0
  355. */
  356. identityFunctionCheck?: DevModeCheckFrequency;
  357. children: ReactNode;
  358. }
  359. declare function Provider<A extends Action<string> = UnknownAction, S = unknown>({ store, context, children, serverState, stabilityCheck, identityFunctionCheck, }: ProviderProps<A, S>): React$1.JSX.Element;
  360. /**
  361. * Hook factory, which creates a `useDispatch` hook bound to a given context.
  362. *
  363. * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
  364. * @returns {Function} A `useDispatch` hook bound to the specified context.
  365. */
  366. declare function createDispatchHook<S = unknown, A extends Action<string> = UnknownAction>(context?: Context<ReactReduxContextValue<S, A> | null>): <AppDispatch extends Dispatch<A> = Dispatch<A>>() => AppDispatch;
  367. /**
  368. * A hook to access the redux `dispatch` function.
  369. *
  370. * @returns {any|function} redux store's `dispatch` function
  371. *
  372. * @example
  373. *
  374. * import React, { useCallback } from 'react'
  375. * import { useDispatch } from 'react-redux'
  376. *
  377. * export const CounterComponent = ({ value }) => {
  378. * const dispatch = useDispatch()
  379. * const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), [])
  380. * return (
  381. * <div>
  382. * <span>{value}</span>
  383. * <button onClick={increaseCounter}>Increase counter</button>
  384. * </div>
  385. * )
  386. * }
  387. */
  388. declare const useDispatch: <AppDispatch extends Dispatch<UnknownAction> = Dispatch<UnknownAction>>() => AppDispatch;
  389. /**
  390. * Hook factory, which creates a `useStore` hook bound to a given context.
  391. *
  392. * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
  393. * @returns {Function} A `useStore` hook bound to the specified context.
  394. */
  395. declare function createStoreHook<S = unknown, A extends Action = UnknownAction>(context?: Context<ReactReduxContextValue<S, A> | null>): <State = S, Action2 extends Action = A>() => Store<State, Action2, {}>;
  396. /**
  397. * A hook to access the redux store.
  398. *
  399. * @returns {any} the redux store
  400. *
  401. * @example
  402. *
  403. * import React from 'react'
  404. * import { useStore } from 'react-redux'
  405. *
  406. * export const ExampleComponent = () => {
  407. * const store = useStore()
  408. * return <div>{store.getState()}</div>
  409. * }
  410. */
  411. declare const useStore: <State = unknown, Action2 extends Action = UnknownAction>() => Store<State, Action2, {}>;
  412. declare function shallowEqual(objA: any, objB: any): boolean;
  413. declare const batch: (cb: () => void) => void;
  414. export { AnyIfEmpty, Connect, ConnectProps, ConnectPropsMaybeWithoutContext, ConnectedComponent, ConnectedProps, DispatchProp, DistributiveOmit, EqualityFn, ExtendedEqualityFn, FixTypeLater, GetLibraryManagedProps, GetProps, HandleThunkActionCreator, InferThunkActionCreatorType, InferableComponentEnhancer, InferableComponentEnhancerWithProps, MapDispatchToProps, MapDispatchToPropsFactory, MapDispatchToPropsFunction, MapDispatchToPropsNonObject, MapDispatchToPropsParam, MapStateToProps, MapStateToPropsFactory, MapStateToPropsParam, Mapped, Matching, MergeProps, NoInfer, Provider, ProviderProps, ReactReduxContext, ReactReduxContextValue, ResolveThunks, Selector, SelectorFactory, Shared, Subscription, TypedUseSelectorHook, batch, _default as connect, createDispatchHook, createSelectorHook, createStoreHook, shallowEqual, useDispatch, useSelector, useStore };