T
TanStack2y ago
environmental-rose

How to type queries without inference?

How can I remove as const from this and add real types?
No description
3 Replies
ratty-blush
ratty-blush2y ago
Not sure I fully understand the problem but maybe queryOptions?
ratty-blush
ratty-blush2y 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...
environmental-rose
environmental-roseOP2y ago
yep this is it. thanks!

Did you find this page helpful?