From 06a756f44fd4f2f42b4e40fb6308f4f10c5d5917 Mon Sep 17 00:00:00 2001 From: ICodeMyOwnLife Date: Fri, 23 Jul 2021 20:50:03 +0700 Subject: [PATCH] fix(MutationOptions): improve the type of onMutate set the return type of onMutate as Promise instead of Promise | Promise to make it work with async functions --- src/core/types.ts | 2 +- src/react/types.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/types.ts b/src/core/types.ts index ba3fafd529..8d1b94c9ad 100644 --- a/src/core/types.ts +++ b/src/core/types.ts @@ -481,7 +481,7 @@ export interface MutationOptions< variables?: TVariables onMutate?: ( variables: TVariables - ) => Promise | Promise | TContext | undefined + ) => Promise | TContext | undefined onSuccess?: ( data: TData, variables: TVariables, diff --git a/src/react/types.ts b/src/react/types.ts index 6e6da2f088..ef98597c46 100644 --- a/src/react/types.ts +++ b/src/react/types.ts @@ -77,7 +77,7 @@ export interface UseMutationOptions< mutationKey?: MutationKey onMutate?: ( variables: TVariables - ) => Promise | Promise | TContext | undefined + ) => Promise | TContext | undefined onSuccess?: ( data: TData, variables: TVariables,