Skip to content
Discussion options

You must be logged in to vote

I think I have a fix here, see this test:

describe('custom hook', () => {
it('should allow custom hooks using UseQueryOptions', () => {
doNotExecute(() => {
type Data = string
const useCustomQuery = (
options?: Omit<UseQueryOptions<Data>, 'queryKey' | 'queryFn'>,
) => {
return useQuery({
...options,
queryKey: ['todos-key'],
queryFn: () => Promise.resolve('data'),
})
}
const { data } = useCustomQuery()
const result: Expect<Equal<Data | undefined, typeof data>> = true
return result
})
})

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@TkDodo
Comment options

Answer selected by yilinsim
@yilinsim
Comment options

@TkDodo
Comment options

@yilinsim
Comment options

@TkDodo
Comment options

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