-
Hey. I'm having trouble creating a wrapper around a query that accepts a I've setup a reproduction here. The problem is that the type of |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
which means the type you have to return from
I prefer the second approach because it’s way simpler and one of the reasons we introduced |
Beta Was this translation helpful? Give feedback.
-
Thanks, @TkDodo. |
Beta Was this translation helpful? Give feedback.
select
can’t be typed withReturnType
, because that will give you:which means the type you have to return from
select
needs to be the same as the one thequeryFn
returns. You need to:useTodos
generic (ts playground)useTodos
abstraction and just inline the query options (ts playground)I prefer the second approach because it’s way simpler and one of the reasons we introduced
queryOptions
as the main abstraction for your queries is that it makes things like this easier to use.