2.0.8
Changes
feat: automatically infer TQueryData by TQueryKey
feat: include TError in the return type of getOptions
feat: using useSuspenseQuery instead of useQuery in v5
Benefit from ReactQuery v5
Automatically infer TQueryData from TQueryKey
const useTest = createQuery({
primaryKey: 'test',
queryFn: () => `string`,
})
const data = queryClient.getQueryData(useTest.getKey())
// ^? const data: string | undefined
Register a global error
declare module '@tanstack/react-query' {
interface Register {
defaultError: AxiosError
}
}
const useTest = createQuery({
primaryKey: 'test',
queryFn: () => `string`,
})
const { error } = useTest()
// ^? const error: AxiosError | null