77 UseQueryOptions as TanStackUseQueryOptions ,
88 UseSuspenseInfiniteQueryOptions as TanStackUseSuspenseInfiniteQueryOptions ,
99 UseSuspenseQueryOptions as TanStackUseSuspenseQueryOptions ,
10+ SkipToken ,
1011} from '@tanstack/react-query' ;
11- import { AppRoute , AreAllPropertiesOptional , ClientArgs } from '@ts-rest/core' ;
12+ import { AppRoute , ClientArgs , IfAllPropertiesOptional } from '@ts-rest/core' ;
1213import { QueriesOptions , QueriesResults } from '../internal/queries-options' ;
1314import {
1415 SuspenseQueriesOptions ,
@@ -20,14 +21,38 @@ export type TsRestQueryOptions<
2021 TAppRoute extends AppRoute ,
2122 TClientArgs extends ClientArgs ,
2223 TQueryData = RequestData < TAppRoute , TClientArgs > ,
23- > = AreAllPropertiesOptional < TQueryData > extends true
24- ? { queryData ?: TQueryData }
25- : { queryData : TQueryData } ;
24+ > = IfAllPropertiesOptional <
25+ TQueryData ,
26+ { queryData ?: TQueryData | SkipToken } ,
27+ { queryData : TQueryData | SkipToken }
28+ > ;
29+
30+ export type TsRestSuspenseQueryOptions <
31+ TAppRoute extends AppRoute ,
32+ TClientArgs extends ClientArgs ,
33+ TQueryData = RequestData < TAppRoute , TClientArgs > ,
34+ > = IfAllPropertiesOptional <
35+ TQueryData ,
36+ { queryData ?: TQueryData } ,
37+ { queryData : TQueryData }
38+ > ;
2639
2740export type TsRestInfiniteQueryOptions <
2841 TAppRoute extends AppRoute ,
2942 TClientArgs extends ClientArgs ,
3043 TPageParam = unknown ,
44+ > = {
45+ queryData :
46+ | ( (
47+ context : QueryFunctionContext < QueryKey , TPageParam > ,
48+ ) => RequestData < TAppRoute , TClientArgs > )
49+ | SkipToken ;
50+ } ;
51+
52+ export type TsRestSuspenseInfiniteQueryOptions <
53+ TAppRoute extends AppRoute ,
54+ TClientArgs extends ClientArgs ,
55+ TPageParam = unknown ,
3156> = {
3257 queryData : (
3358 context : QueryFunctionContext < QueryKey , TPageParam > ,
@@ -96,7 +121,7 @@ export type UseSuspenseQueryOptions<
96121 > ,
97122 'queryFn'
98123> &
99- TsRestQueryOptions < TAppRoute , TClientArgs > ;
124+ TsRestSuspenseQueryOptions < TAppRoute , TClientArgs > ;
100125
101126export type UseInfiniteQueryOptions <
102127 TAppRoute extends AppRoute ,
@@ -152,7 +177,7 @@ export type UseSuspenseInfiniteQueryOptions<
152177 > ,
153178 'queryFn'
154179> &
155- TsRestInfiniteQueryOptions < TAppRoute , TClientArgs , TPageParam > ;
180+ TsRestSuspenseInfiniteQueryOptions < TAppRoute , TClientArgs , TPageParam > ;
156181
157182export type UseMutationOptions <
158183 TAppRoute extends AppRoute ,
0 commit comments