-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(UseMutationResult): result type should be more specific to allow type narrowing #2620
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/tannerlinsley/react-query/3fsKtN53tVXMh2Ghi5kedvpg3JdZ |
197ebaf
to
9a95f9a
Compare
c916832
to
454875f
Compare
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:
|
3714a6b
to
77e4108
Compare
b6255dd
to
9c38dd4
Compare
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 |
fad9fcd
to
ca3a56a
Compare
…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
1bef391
to
f4d9ce7
Compare
🎉 This PR is included in version 3.23.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
fixes #2601
This PR refactors useMutationResult type to follow the same approach/logic of useQueryResult type.