-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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(types): fix MutateFunction #674
Conversation
TVariables now extends undefined to determine the return type of MutateFunction.
@all-contributors Please add @jelteliekens for code |
I've put up a pull request to add @jelteliekens! 🎉 |
As I said in my issue (#661), this fix doesn't seem to be helpfull |
@basslagter It is merged with master but not yet release. v2.4.6 doesn't include this fix yet. Hopefully it does solve your issue once it get released. |
🎉 This PR is included in version 2.4.7 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Works! Thanks |
I think that this change is making |
Can you give a code example? If you expect variabels in the mutate function to do your API call, isn’t it required to pass variables when calling the mutation function? |
Yes, but not all API calls require variables and thus mutate doesn't require it either: https://github.com/tannerlinsley/react-query#returns-3 const [mutate] = useMutation(() => {
return axiox.post('/some/url');
}); |
I don't know what the right fix is. I'm not claiming this needs to be reverted. But before this change I was able to call mutate with no args, then after the change the compiler is telling me that at least one arg is required. I deal with it by just passing |
TVariables now extends undefined to determine the return type of MutateFunction.
Fixes #661. When disableling
--strictNullChecks
undefined
is always in every type's domain.undefined extends TVariables
would always be true.