@@ -19,7 +19,7 @@ export type QueryKey<
1919 Paths extends Record < string , Record < HttpMethod , { } > > ,
2020 Method extends HttpMethod ,
2121 Path extends PathsWithMethod < Paths , Method > ,
22- > = readonly [ FetchClient < Paths > , Method , Path , MaybeOptionalInit < Paths [ Path ] , Method > ] ;
22+ > = readonly [ FetchClient < Paths , MediaType > , Method , Path , MaybeOptionalInit < Paths [ Path ] , Method > ] ;
2323
2424export type QueryOptionsFunction < Paths extends Record < string , Record < HttpMethod , { } > > , Media extends MediaType > = <
2525 Method extends HttpMethod ,
@@ -33,9 +33,8 @@ export type QueryOptionsFunction<Paths extends Record<string, Record<HttpMethod,
3333> (
3434 method : Method ,
3535 path : Path ,
36- ...[ init , options ] : RequiredKeysOf < Init > extends never
37- ? [ InitWithUnknowns < Init > ?, Options ?]
38- : [ InitWithUnknowns < Init > , Options ?]
36+ init ?: InitWithUnknowns < Init > ,
37+ options ?: Options ,
3938) => NoInfer <
4039 Omit <
4140 UseQueryOptions < Response [ "data" ] , Response [ "error" ] , Response [ "data" ] , QueryKey < Paths , Method , Path > > ,
@@ -119,18 +118,17 @@ export default function createClient<Paths extends {}, Media extends MediaType =
119118 return data ;
120119 } ;
121120
122- const queryOptions : QueryOptionsFunction < Paths , Media > = ( method , path , ... [ init , options ] ) => ( {
121+ const queryOptions : QueryOptionsFunction < Paths , Media > = ( method , path , init ) => ( {
123122 queryKey : [ client , method , path , init as InitWithUnknowns < typeof init > ] as const ,
124123 queryFn,
125- ...options ,
126124 } ) ;
127125
128126 return {
129127 queryOptions,
130128 useQuery : ( method , path , ...[ init , options , queryClient ] ) =>
131- useQuery ( queryOptions ( method , path , init as InitWithUnknowns < typeof init > , options ) , queryClient ) ,
129+ useQuery ( { ... queryOptions ( method , path , init ) , ... options } , queryClient ) ,
132130 useSuspenseQuery : ( method , path , ...[ init , options , queryClient ] ) =>
133- useSuspenseQuery ( queryOptions ( method , path , init as InitWithUnknowns < typeof init > , options ) , queryClient ) ,
131+ useSuspenseQuery ( { ... queryOptions ( method , path , init ) , ... options } , queryClient ) ,
134132 useMutation : ( method , path , options , queryClient ) =>
135133 useMutation (
136134 {
0 commit comments