From 9f6c992feecb4694758f8767063d8ad89d842c3c Mon Sep 17 00:00:00 2001 From: Sunil Hari Date: Sun, 29 May 2022 23:37:46 +0530 Subject: [PATCH] fix(types): change types for useMutation context in onSuccess (#3654) changes context to optional in onSuccess callback --- src/core/mutation.ts | 2 +- src/core/types.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/mutation.ts b/src/core/mutation.ts index 58796a3a6b..6019940ad8 100644 --- a/src/core/mutation.ts +++ b/src/core/mutation.ts @@ -178,7 +178,7 @@ export class Mutation< this.options.onSuccess?.( data, this.state.variables!, - this.state.context! + this.state.context ) ) .then(() => diff --git a/src/core/types.ts b/src/core/types.ts index 63d04d5e6b..1a857669c5 100644 --- a/src/core/types.ts +++ b/src/core/types.ts @@ -548,7 +548,7 @@ export interface MutationOptions< onSuccess?: ( data: TData, variables: TVariables, - context: TContext + context: TContext | undefined ) => Promise | void onError?: ( error: TError,