Skip to content

Commit a88d80f

Browse files
authored
fix(types): Add undefined return type in onMutate (#2089)
* onMutate callback add void in return type * Add core type * return type void to undefined * onMutate return type change 'Promise<TContext> | Promise<undefined> | TContext | undefined'
1 parent d7d766e commit a88d80f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/core/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ export interface MutationOptions<
474474
mutationFn?: MutationFunction<TData, TVariables>
475475
mutationKey?: MutationKey
476476
variables?: TVariables
477-
onMutate?: (variables: TVariables) => Promise<TContext> | TContext
477+
onMutate?: (variables: TVariables) => Promise<TContext> | Promise<undefined> | TContext | undefined
478478
onSuccess?: (
479479
data: TData,
480480
variables: TVariables,

src/react/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export interface UseMutationOptions<
7575
TContext = unknown
7676
> {
7777
mutationKey?: string | unknown[]
78-
onMutate?: (variables: TVariables) => Promise<TContext> | TContext
78+
onMutate?: (variables: TVariables) => Promise<TContext> | Promise<undefined> | TContext | undefined
7979
onSuccess?: (
8080
data: TData,
8181
variables: TVariables,

0 commit comments

Comments
 (0)