Skip to content

When passing options, useQuery does not accept types #8283

Answered by TkDodo
nickeremin asked this question in Q&A
Discussion options

You must be logged in to vote

if you pass initialData into it, for example, then data should not be undefined

this is a feature we have achieved with overloads in TypeScript. If you build your custom abstraction and want that, you need to either define overloads yourself or use conditional return types.

My suggestion is to use queryOptions instead of building custom abstractions: typescript playground

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@nickeremin
Comment options

@TkDodo
Comment options

Answer selected by nickeremin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants