Skip to content

Commit

Permalink
feat: improve UseMutationReturnType (#3714)
Browse files Browse the repository at this point in the history
* feat: improve `UseMutationReturnType`

Previously, `Omit` broke the discriminated union that was returned in `UseMutationReturnType`.

By using `UnionOmit`, the union is preserved.

* Create large-apricots-grow.md

---------

Co-authored-by: jxom <jakemoxey@gmail.com>
  • Loading branch information
dalechyn and jxom authored Mar 17, 2024
1 parent 58be0f8 commit f1628d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/large-apricots-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wagmi": patch
---

Replaced `Omit` with `UnionOmit` for `UseMutationReturnType`.
3 changes: 2 additions & 1 deletion packages/react/src/utils/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
type Evaluate,
type ExactPartial,
type Omit,
type UnionOmit,
deepEqual,
} from '@wagmi/core/internal'
import { hashFn } from '@wagmi/core/query'
Expand All @@ -37,7 +38,7 @@ export type UseMutationReturnType<
variables = void,
context = unknown,
> = Evaluate<
Omit<
UnionOmit<
UseMutationResult<data, error, variables, context>,
'mutate' | 'mutateAsync'
>
Expand Down

0 comments on commit f1628d6

Please sign in to comment.