refactor(query-core): Make MutationMeta and QueryMeta generic#5457
refactor(query-core): Make MutationMeta and QueryMeta generic#5457vojvodics wants to merge 2 commits intoTanStack:alphafrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
|
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. |
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 6928516. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
|
what's problematic about using functions inside so, I'm unsure if we should make it generic just to support that case 🤔 |
|
yeah, I see the reason to discourage the usage of functions in meta. That's a problem even without generics. |
|
please reopen to the |
This is a rework of #5412 for v5
The basic idea is that we can infer types from meta fields passed in as functions:
This, however, requires some setup from the user:
Also, as mentioned in #5412 - the inference will only work if used in useMutation/useQuery.
Because all generic parameters are optional, this should work exactly the same as before and you don't need to use generics if you don't have to.