Skip to content

Conversation

@raoufswe
Copy link
Contributor

@raoufswe raoufswe commented Aug 31, 2021

fixes #2601

This PR refactors useMutationResult type to follow the same approach/logic of useQueryResult type.

@vercel
Copy link

vercel bot commented Aug 31, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/tannerlinsley/react-query/3fsKtN53tVXMh2Ghi5kedvpg3JdZ
✅ Preview: https://react-query-git-fork-raoufswe-narrowusemut-68281a-tannerlinsley.vercel.app

@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 31, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit f4d9ce7:

Sandbox Source
tannerlinsley/react-query: basic Configuration
tannerlinsley/react-query: basic-typescript Configuration

@raoufswe raoufswe marked this pull request as ready for review August 31, 2021 19:03
@TkDodo
Copy link
Collaborator

TkDodo commented Sep 8, 2021

hmm, for some reason, the type narrowing doesn't seem to work in the codesandbox preview builds. Can you have a look?

https://codesandbox.io/s/tannerlinsley-react-query-basic-typescript-forked-6zf7r?file=/src/index.tsx

…o allow narrowing to match useQuery

fix(UseMutationResult): unify result type between core and react

fix(UseMutationResult): revert back mutateAsync to core/types

fix(mutationObserver): updateResult should declare a type then cast

fix(useMutation): revert some changes

fix(useMutation): revert uneeded changes

fix(useMutation): use Exclude instead of Omit to override mutate to return the correct union type

fix(useMutation): add Override to override mutate and return correct union type
@TkDodo TkDodo merged commit c956f1a into TanStack:master Sep 9, 2021
@tannerlinsley
Copy link
Member

🎉 This PR is included in version 3.23.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MutationState type should be more specific, to allow narrowing to match useQuery

3 participants