11import type {
2+ SeamActionAttemptFailedError ,
3+ SeamActionAttemptTimeoutError ,
24 SeamHttpApiError ,
35 SeamHttpEndpointPaginatedQueryPaths ,
46 SeamHttpEndpoints ,
7+ SeamHttpInvalidInputError ,
58 SeamHttpRequest ,
69 SeamPageCursor ,
710} from '@seamapi/http/connect'
11+ import type { ActionAttempt } from '@seamapi/types/connect'
812import {
913 useInfiniteQuery ,
1014 type UseInfiniteQueryOptions ,
@@ -19,15 +23,15 @@ export type UseSeamInfiniteQueryParameters<
1923
2024export type UseSeamInfiniteQueryResult <
2125 T extends SeamHttpEndpointPaginatedQueryPaths ,
22- > = UseInfiniteQueryResult < QueryData < T > , SeamHttpApiError >
26+ > = UseInfiniteQueryResult < QueryData < T > , QueryError < T > >
2327
2428export function useSeamInfiniteQuery <
2529 T extends SeamHttpEndpointPaginatedQueryPaths ,
2630> (
2731 endpointPath : T ,
2832 parameters ?: UseSeamInfiniteQueryParameters < T > ,
2933 options : Parameters < SeamHttpEndpoints [ T ] > [ 1 ] &
30- QueryOptions < QueryData < T > , SeamHttpApiError > = { }
34+ QueryOptions < QueryData < T > , QueryError < T > > = { }
3135) : UseSeamInfiniteQueryResult < T > {
3236 const { endpointClient : client , queryKeyPrefixes } = useSeamClient ( )
3337 return useInfiniteQuery ( {
@@ -75,6 +79,16 @@ interface QueryData<T extends SeamHttpEndpointPaginatedQueryPaths> {
7579 nextPageCursor : SeamPageCursor | null
7680}
7781
82+ type QueryError < T extends SeamHttpEndpointPaginatedQueryPaths > =
83+ | Error
84+ | SeamHttpApiError
85+ | SeamHttpInvalidInputError
86+ | ( QueryData < T > [ 'data' ] extends ActionAttempt
87+ ?
88+ | SeamActionAttemptFailedError < QueryData < T > [ 'data' ] >
89+ | SeamActionAttemptTimeoutError < QueryData < T > [ 'data' ] >
90+ : never )
91+
7892type QueryOptions < X , Y > = Omit <
7993 UseInfiniteQueryOptions < X , Y > ,
8094 'queryKey' | 'queryFn' | 'initialPageParam' | 'getNextPageParam'
0 commit comments