@@ -12,6 +12,8 @@ import { capitalize } from '../utils'
12
12
import { safeAssign } from '../tsHelpers'
13
13
import { BaseQueryFn } from '../baseQueryTypes'
14
14
15
+ import { HooksWithUniqueNames } from './versionedTypes/index'
16
+
15
17
import {
16
18
useDispatch as rrUseDispatch ,
17
19
useSelector as rrUseSelector ,
@@ -24,35 +26,45 @@ import { PrefetchOptions } from '../core/module'
24
26
export const reactHooksModuleName = Symbol ( )
25
27
export type ReactHooksModule = typeof reactHooksModuleName
26
28
27
- export interface ReactHooksBaseEndpoints <
28
- Definitions extends EndpointDefinitions
29
- > {
30
- /**
31
- * Endpoints based on the input endpoints provided to `createApi`, containing `select`, `hooks` and `action matchers`.
32
- */
33
- endpoints : {
34
- [ K in keyof Definitions ] : Definitions [ K ] extends QueryDefinition <
35
- any ,
36
- any ,
37
- any ,
38
- any ,
39
- any
40
- >
41
- ? QueryHooks < Definitions [ K ] >
42
- : Definitions [ K ] extends MutationDefinition < any , any , any , any , any >
43
- ? MutationHooks < Definitions [ K ] >
44
- : never
29
+ declare module '../apiTypes' {
30
+ export interface ApiModules <
31
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
32
+ BaseQuery extends BaseQueryFn ,
33
+ Definitions extends EndpointDefinitions ,
34
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
35
+ ReducerPath extends string ,
36
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
37
+ TagTypes extends string
38
+ > {
39
+ [ reactHooksModuleName ] : {
40
+ /**
41
+ * Endpoints based on the input endpoints provided to `createApi`, containing `select`, `hooks` and `action matchers`.
42
+ */
43
+ endpoints : {
44
+ [ K in keyof Definitions ] : Definitions [ K ] extends QueryDefinition <
45
+ any ,
46
+ any ,
47
+ any ,
48
+ any ,
49
+ any
50
+ >
51
+ ? QueryHooks < Definitions [ K ] >
52
+ : Definitions [ K ] extends MutationDefinition < any , any , any , any , any >
53
+ ? MutationHooks < Definitions [ K ] >
54
+ : never
55
+ }
56
+ /**
57
+ * A hook that accepts a string endpoint name, and provides a callback that when called, pre-fetches the data for that endpoint.
58
+ */
59
+ usePrefetch < EndpointName extends QueryKeys < Definitions > > (
60
+ endpointName : EndpointName ,
61
+ options ?: PrefetchOptions
62
+ ) : (
63
+ arg : QueryArgFrom < Definitions [ EndpointName ] > ,
64
+ options ?: PrefetchOptions
65
+ ) => void
66
+ } & HooksWithUniqueNames < Definitions >
45
67
}
46
- /**
47
- * A hook that accepts a string endpoint name, and provides a callback that when called, pre-fetches the data for that endpoint.
48
- */
49
- usePrefetch < EndpointName extends QueryKeys < Definitions > > (
50
- endpointName : EndpointName ,
51
- options ?: PrefetchOptions
52
- ) : (
53
- arg : QueryArgFrom < Definitions [ EndpointName ] > ,
54
- options ?: PrefetchOptions
55
- ) => void
56
68
}
57
69
58
70
// type RR = typeof import('react-redux')
0 commit comments