Skip to content

Commit 602cd20

Browse files
committed
Rename OnQueryStarted types
1 parent 2199c0a commit 602cd20

File tree

5 files changed

+30
-20
lines changed

5 files changed

+30
-20
lines changed

packages/toolkit/src/query/core/buildMiddleware/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ export type {
3535
MutationLifecycleApi,
3636
QueryLifecycleApi,
3737
ReferenceQueryLifecycle,
38-
TypedOnQueryStartedForMutationEndpoints,
39-
TypedOnQueryStartedForQueryEndpoints,
38+
TypedMutationOnQueryStarted,
39+
TypedQueryOnQueryStarted,
4040
} from './queryLifecycle'
4141
export type { SubscriptionSelectors } from './types'
4242

packages/toolkit/src/query/core/buildMiddleware/queryLifecycle.ts

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,12 @@ export type QueryLifecycleQueryExtraOptions<
112112
*/
113113
onQueryStarted?(
114114
queryArgument: QueryArg,
115-
queryLifeCycleApi: QueryLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>,
115+
queryLifeCycleApi: QueryLifecycleApi<
116+
QueryArg,
117+
BaseQuery,
118+
ResultType,
119+
ReducerPath
120+
>,
116121
): Promise<void> | void
117122
}
118123

@@ -172,7 +177,12 @@ export type QueryLifecycleMutationExtraOptions<
172177
*/
173178
onQueryStarted?(
174179
queryArgument: QueryArg,
175-
mutationLifeCycleApi: MutationLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>,
180+
mutationLifeCycleApi: MutationLifecycleApi<
181+
QueryArg,
182+
BaseQuery,
183+
ResultType,
184+
ReducerPath
185+
>,
176186
): Promise<void> | void
177187
}
178188

@@ -201,7 +211,7 @@ export type MutationLifecycleApi<
201211
* <caption>#### __Create and reuse a strongly-typed `onQueryStarted` function__</caption>
202212
*
203213
* ```ts
204-
* import type { TypedOnQueryStartedForQueryEndpoints } from '@reduxjs/toolkit/query'
214+
* import type { TypedQueryOnQueryStarted } from '@reduxjs/toolkit/query'
205215
* import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'
206216
*
207217
* type Post = {
@@ -236,7 +246,7 @@ export type MutationLifecycleApi<
236246
* }),
237247
* })
238248
*
239-
* const updatePostOnFulfilled: TypedOnQueryStartedForQueryEndpoints<
249+
* const updatePostOnFulfilled: TypedQueryOnQueryStarted<
240250
* PostsApiResponse,
241251
* QueryArgument,
242252
* BaseQueryFunction,
@@ -278,7 +288,7 @@ export type MutationLifecycleApi<
278288
* @since 2.4.0
279289
* @public
280290
*/
281-
export type TypedOnQueryStartedForQueryEndpoints<
291+
export type TypedQueryOnQueryStarted<
282292
ResultType,
283293
QueryArgumentType,
284294
BaseQueryFunctionType extends BaseQueryFn,
@@ -299,7 +309,7 @@ export type TypedOnQueryStartedForQueryEndpoints<
299309
* <caption>#### __Create and reuse a strongly-typed `onQueryStarted` function__</caption>
300310
*
301311
* ```ts
302-
* import type { TypedOnQueryStartedForMutationEndpoints } from '@reduxjs/toolkit/query'
312+
* import type { TypedMutationOnQueryStarted } from '@reduxjs/toolkit/query'
303313
* import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'
304314
*
305315
* type Post = {
@@ -334,7 +344,7 @@ export type TypedOnQueryStartedForQueryEndpoints<
334344
* }),
335345
* })
336346
*
337-
* const updatePostOnFulfilled: TypedOnQueryStartedForMutationEndpoints<
347+
* const updatePostOnFulfilled: TypedMutationOnQueryStarted<
338348
* Post,
339349
* QueryArgument,
340350
* BaseQueryFunction,
@@ -386,7 +396,7 @@ export type TypedOnQueryStartedForQueryEndpoints<
386396
* @since 2.4.0
387397
* @public
388398
*/
389-
export type TypedOnQueryStartedForMutationEndpoints<
399+
export type TypedMutationOnQueryStarted<
390400
ResultType,
391401
QueryArgumentType,
392402
BaseQueryFunctionType extends BaseQueryFn,

packages/toolkit/src/query/core/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export type {
2424
QueryCacheLifecycleApi,
2525
QueryLifecycleApi,
2626
SubscriptionSelectors,
27-
TypedOnQueryStartedForMutationEndpoints,
28-
TypedOnQueryStartedForQueryEndpoints,
27+
TypedMutationOnQueryStarted,
28+
TypedQueryOnQueryStarted,
2929
} from './buildMiddleware/index'
3030
export { skipToken } from './buildSelectors'
3131
export type {

packages/toolkit/src/query/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ export { _NEVER, fakeBaseQuery } from './fakeBaseQuery'
7070
export { copyWithStructuralSharing } from './utils/copyWithStructuralSharing'
7171
export { createApi, coreModule, coreModuleName } from './core/index'
7272
export type {
73-
TypedOnQueryStartedForMutationEndpoints,
74-
TypedOnQueryStartedForQueryEndpoints,
73+
TypedMutationOnQueryStarted,
74+
TypedQueryOnQueryStarted,
7575
} from './core/index'
7676
export type {
7777
ApiEndpointMutation,

packages/toolkit/src/query/tests/queryLifecycle.test-d.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import type {
44
FetchBaseQueryError,
55
FetchBaseQueryMeta,
66
RootState,
7-
TypedOnQueryStartedForMutationEndpoints,
8-
TypedOnQueryStartedForQueryEndpoints,
7+
TypedMutationOnQueryStarted,
8+
TypedQueryOnQueryStarted,
99
} from '@reduxjs/toolkit/query'
1010
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query'
1111

@@ -155,7 +155,7 @@ describe('type tests', () => {
155155
})
156156

157157
describe('typed `onQueryStarted` function', () => {
158-
test('TypedOnQueryStartedForQueryEndpoints creates a pre-typed version of onQueryStarted', () => {
158+
test('TypedQueryOnQueryStarted creates a pre-typed version of onQueryStarted', () => {
159159
type Post = {
160160
id: number
161161
title: string
@@ -188,7 +188,7 @@ describe('type tests', () => {
188188
}),
189189
})
190190

191-
const updatePostOnFulfilled: TypedOnQueryStartedForQueryEndpoints<
191+
const updatePostOnFulfilled: TypedQueryOnQueryStarted<
192192
PostsApiResponse,
193193
QueryArgument,
194194
BaseQueryFunction,
@@ -256,7 +256,7 @@ describe('type tests', () => {
256256
})
257257
})
258258

259-
test('TypedOnQueryStartedForMutationEndpoints creates a pre-typed version of onQueryStarted', () => {
259+
test('TypedMutationOnQueryStarted creates a pre-typed version of onQueryStarted', () => {
260260
type Post = {
261261
id: number
262262
title: string
@@ -289,7 +289,7 @@ describe('type tests', () => {
289289
}),
290290
})
291291

292-
const updatePostOnFulfilled: TypedOnQueryStartedForMutationEndpoints<
292+
const updatePostOnFulfilled: TypedMutationOnQueryStarted<
293293
Post,
294294
QueryArgument,
295295
BaseQueryFunction,

0 commit comments

Comments
 (0)