Typescript and conditional select
Hi,
So I want to have a query
`
and then I have something like this
select gives the error
`
Help! 🙂
6 Replies
quickest-silver•2y ago
Please create a typescript playground
extended-salmon•2y ago
Dominik 🔮 (@TkDodo) on X
It doesn't take a lot of #TypeScript magic to get type inference with the select option in React Query. We need:
- One generic with a default value
- Types for the select argument
That's it 🙌

Twitter
national-goldOP•2y ago
TS Playground - An online editor for exploring TypeScript and JavaS...
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
national-goldOP•2y ago
But big thanks @TkDodo 🔮 🙂
extended-salmon•2y ago
TS Playground - An online editor for exploring TypeScript and JavaS...
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
national-goldOP•2y ago
Thank you! 🌟