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 |
|
View your CI Pipeline Execution ↗ for commit 3165838
☁️ Nx Cloud last updated this comment at |
TVariables now extends undefined to determine the return type of MutateFunction.
Fixes #661. When disableling
--strictNullChecksundefinedis always in every type's domain.undefined extends TVariableswould always be true.