T
TanStack15mo ago
frail-apricot

How to type queries without inference?

How can I remove as const from this and add real types?
No description
3 Replies
continuing-cyan
continuing-cyan15mo ago
Not sure I fully understand the problem but maybe queryOptions?
continuing-cyan
continuing-cyan15mo ago
Query Options | TanStack Query React Docs
One of the best ways to share queryKey and queryFn between multiple places, yet keep them co-located to one another, is to use the queryOptions helper. At runtime, this helper just returns whatever you pass into it, but it has a lot of advantages when using it with TypeScript. You can define all possible options for a query in one place, and yo...
frail-apricot
frail-apricotOP15mo ago
yep this is it. thanks!

Did you find this page helpful?