-
|
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.
selectcan’t be typed withReturnType, because that will give you:which means the type you have to return from
selectneeds to be the same as the one thequeryFnreturns. You need to:useTodosgeneric (ts playground)useTodosabstraction 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
queryOptionsas the main abstraction for your queries is that it makes things like this easier to use.