From 65d5a64e76c26a9b9c4976847da6da11ab43f4dc Mon Sep 17 00:00:00 2001 From: EskiMojo14 Date: Wed, 14 Feb 2024 18:21:19 +0000 Subject: [PATCH 1/3] rename TypedUseMutationTrigger to TypedMutationTrigger, and add deprecated alias --- packages/toolkit/src/query/react/buildHooks.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/toolkit/src/query/react/buildHooks.ts b/packages/toolkit/src/query/react/buildHooks.ts index d3a8581a8b..3102f42e9f 100644 --- a/packages/toolkit/src/query/react/buildHooks.ts +++ b/packages/toolkit/src/query/react/buildHooks.ts @@ -589,7 +589,7 @@ export type MutationTrigger> = (arg: QueryArgFrom): MutationActionCreatorResult } -export type TypedUseMutationTrigger< +export type TypedMutationTrigger< ResultType, QueryArg, BaseQuery extends BaseQueryFn, @@ -597,6 +597,15 @@ export type TypedUseMutationTrigger< MutationDefinition > +/** + * @deprecated Prefer `TypedMutationTrigger`, this will be removed in the next major version. + */ +export type TypedUseMutationTrigger< + ResultType, + QueryArg, + BaseQuery extends BaseQueryFn, +> = TypedMutationTrigger + /** * Wrapper around `defaultQueryStateSelector` to be used in `useQuery`. * We want the initial render to already come back with From 9a4cdaa6a127eb357d4fb000c2611fb6505d1045 Mon Sep 17 00:00:00 2001 From: EskiMojo14 Date: Wed, 14 Feb 2024 18:26:49 +0000 Subject: [PATCH 2/3] remove alias --- packages/toolkit/src/query/react/buildHooks.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/packages/toolkit/src/query/react/buildHooks.ts b/packages/toolkit/src/query/react/buildHooks.ts index 3102f42e9f..d2432acc93 100644 --- a/packages/toolkit/src/query/react/buildHooks.ts +++ b/packages/toolkit/src/query/react/buildHooks.ts @@ -597,15 +597,6 @@ export type TypedMutationTrigger< MutationDefinition > -/** - * @deprecated Prefer `TypedMutationTrigger`, this will be removed in the next major version. - */ -export type TypedUseMutationTrigger< - ResultType, - QueryArg, - BaseQuery extends BaseQueryFn, -> = TypedMutationTrigger - /** * Wrapper around `defaultQueryStateSelector` to be used in `useQuery`. * We want the initial render to already come back with From a131b32729a4c42e13bc5c86e7d0c833c00cc356 Mon Sep 17 00:00:00 2001 From: EskiMojo14 Date: Wed, 14 Feb 2024 18:29:12 +0000 Subject: [PATCH 3/3] fix imports and exports --- packages/toolkit/src/query/react/index.ts | 2 +- packages/toolkit/src/query/tests/unionTypes.test-d.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/toolkit/src/query/react/index.ts b/packages/toolkit/src/query/react/index.ts index ba2815f123..c979fbe0f2 100644 --- a/packages/toolkit/src/query/react/index.ts +++ b/packages/toolkit/src/query/react/index.ts @@ -21,7 +21,7 @@ export type { TypedLazyQueryTrigger, TypedUseLazyQuery, TypedUseMutation, - TypedUseMutationTrigger, + TypedMutationTrigger, TypedUseQueryState, TypedUseQuery, TypedUseQuerySubscription, diff --git a/packages/toolkit/src/query/tests/unionTypes.test-d.ts b/packages/toolkit/src/query/tests/unionTypes.test-d.ts index 2ab109dfa9..1c5768d24a 100644 --- a/packages/toolkit/src/query/tests/unionTypes.test-d.ts +++ b/packages/toolkit/src/query/tests/unionTypes.test-d.ts @@ -10,7 +10,7 @@ import type { TypedUseLazyQuery, TypedUseLazyQuerySubscription, TypedUseMutation, - TypedUseMutationTrigger, + TypedMutationTrigger, TypedUseQuerySubscription, TypedUseQuery, } from '@reduxjs/toolkit/query/react' @@ -838,7 +838,7 @@ describe('"Typed" helper types', () => { const [trigger, result] = api.endpoints.mutation.useMutation() expectTypeOf< - TypedUseMutationTrigger + TypedMutationTrigger >().toMatchTypeOf(trigger) expectTypeOf<