11/* eslint-disable @typescript-eslint/no-explicit-any */
22import {
3+ UseSuspenseInfiniteQueryOptions ,
4+ UseSuspenseQueryOptions ,
35 useInfiniteQuery ,
46 useMutation ,
57 useQuery ,
@@ -10,21 +12,19 @@ import {
1012 type UseInfiniteQueryOptions ,
1113 type UseMutationOptions ,
1214 type UseQueryOptions ,
13- UseSuspenseInfiniteQueryOptions ,
14- UseSuspenseQueryOptions ,
1515} from '@tanstack/react-query-v5' ;
1616import type { ModelMeta } from '@zenstackhq/runtime/cross' ;
1717import { createContext , useContext } from 'react' ;
1818import {
1919 DEFAULT_QUERY_ENDPOINT ,
20- FetchFn ,
2120 fetcher ,
2221 getQueryKey ,
2322 makeUrl ,
2423 marshal ,
2524 setupInvalidation ,
2625 setupOptimisticUpdate ,
2726 type APIContext ,
27+ type FetchFn ,
2828} from '../runtime/common' ;
2929
3030/**
@@ -167,12 +167,18 @@ export function useSuspenseInfiniteModelQuery<TQueryFnData, TData, TError>(
167167 * @param checkReadBack Whether to check for read back errors and return undefined if found.
168168 * @param optimisticUpdate Whether to enable automatic optimistic update
169169 */
170- export function useModelMutation < T , R = any , C extends boolean = boolean , Result = C extends true ? R | undefined : R > (
170+ export function useModelMutation <
171+ TArgs ,
172+ TError ,
173+ R = any ,
174+ C extends boolean = boolean ,
175+ Result = C extends true ? R | undefined : R
176+ > (
171177 model : string ,
172178 method : 'POST' | 'PUT' | 'DELETE' ,
173179 url : string ,
174180 modelMeta : ModelMeta ,
175- options ?: Omit < UseMutationOptions < Result , unknown , T > , 'mutationFn' > ,
181+ options ?: Omit < UseMutationOptions < Result , TError , TArgs > , 'mutationFn' > ,
176182 fetch ?: FetchFn ,
177183 invalidateQueries = true ,
178184 checkReadBack ?: C ,
0 commit comments