@@ -9,6 +9,7 @@ import type {
9
9
} from '@reduxjs/toolkit/dist/query/endpointDefinitions'
10
10
import type { Api , Module } from '../apiTypes'
11
11
import { capitalize } from '../utils'
12
+ import type { AllOrNone } from '../tsHelpers'
12
13
import { safeAssign } from '../tsHelpers'
13
14
import type { BaseQueryFn } from '@reduxjs/toolkit/dist/query/baseQueryTypes'
14
15
@@ -69,23 +70,26 @@ declare module '@reduxjs/toolkit/dist/query/apiTypes' {
69
70
70
71
type RR = typeof import ( 'react-redux' )
71
72
72
- export interface ReactHooksModuleOptions {
73
- /**
74
- * The version of the `batchedUpdates` function to be used
75
- */
76
- batch ?: RR [ 'batch' ]
73
+ type ReactHooks = {
77
74
/**
78
75
* The version of the `useDispatch` hook to be used
79
76
*/
80
- useDispatch ? : RR [ 'useDispatch' ]
77
+ useDispatch : RR [ 'useDispatch' ]
81
78
/**
82
79
* The version of the `useSelector` hook to be used
83
80
*/
84
- useSelector ? : RR [ 'useSelector' ]
81
+ useSelector : RR [ 'useSelector' ]
85
82
/**
86
83
* The version of the `useStore` hook to be used
87
84
*/
88
- useStore ?: RR [ 'useStore' ]
85
+ useStore : RR [ 'useStore' ]
86
+ }
87
+
88
+ export type ReactHooksModuleOptions = AllOrNone < ReactHooks > & {
89
+ /**
90
+ * The version of the `batchedUpdates` function to be used
91
+ */
92
+ batch ?: RR [ 'batch' ]
89
93
/**
90
94
* Enables performing asynchronous tasks immediately within a render.
91
95
*
@@ -115,7 +119,11 @@ export interface ReactHooksModuleOptions {
115
119
* const MyContext = React.createContext<ReactReduxContextValue>(null as any);
116
120
* const customCreateApi = buildCreateApi(
117
121
* coreModule(),
118
- * reactHooksModule({ useDispatch: createDispatchHook(MyContext) })
122
+ * reactHooksModule({
123
+ * useDispatch: createDispatchHook(MyContext),
124
+ * useSelector: createSelectorHook(MyContext),
125
+ * useStore: createStoreHook(MyContext)
126
+ * })
119
127
* );
120
128
* ```
121
129
*
0 commit comments