-
Hi Tanner, thanks for creating react-query, it's been a joy to use so far. This is more of a typescript question more than anything, I'm struggling a little bit with typescript return types of custom hooks. Using this as an example: https://react-query.tanstack.com/docs/examples/custom-hooks
What's the best way to specify the return type of Currently I could do something like:
But this seems very manual and repetitive, is there a better way? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
|
Beta Was this translation helpful? Give feedback.
-
You can indeed use |
Beta Was this translation helpful? Give feedback.
-
This thread was helpful! |
Beta Was this translation helpful? Give feedback.
QueryResult
can be used for this, which works pretty nice. See the example of the customuseTodos
anduseJoke
hooks in this sandbox