Skip to content

Feature Request - Improve typings when passing initialData #5080

Answered by TkDodo
iway1 asked this question in Ideas
Discussion options

You must be logged in to vote

that was contributed some time ago - we have tests for this:

it('TData should always be defined when initialData is provided as an object', () => {
doNotExecute(() => {
const { data } = useQuery({
queryKey: ['key'],
queryFn: () => {
return {
wow: true,
}
},
initialData: {
wow: true,
},
})
const result: Expect<Equal<{ wow: boolean }, typeof data>> = true
return result
})
})

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by iway1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants