@@ -8,13 +8,7 @@ import type {
88} from '@tanstack/react-query' ;
99import type { Overwrite } from 'utility-types' ;
1010
11- import type {
12- ActualData ,
13- ActualResponse ,
14- DataLoaderStatus ,
15- DataSource ,
16- DataSourceKey ,
17- } from '../../../core' ;
11+ import type { ActualData , DataLoaderStatus , DataSource , DataSourceKey } from '../../../core' ;
1812import type { QueryDataSourceContext } from '../../types/base' ;
1913import type { QueryDataAdditionalOptions } from '../../types/options' ;
2014
@@ -35,70 +29,61 @@ export type InfiniteQueryObserverExtendedOptions<
3529 >
3630> ;
3731
38- export type InfiniteQueryDataSource < TParams , TRequest , TResponse , TData , TError , TErrorResponse > =
39- DataSource <
40- QueryDataSourceContext ,
41- TParams ,
42- TRequest ,
43- TResponse ,
44- TData ,
45- TError ,
46- TErrorResponse ,
47- InfiniteQueryObserverExtendedOptions <
48- ActualResponse < NoInfer < TResponse > , NoInfer < TErrorResponse > > ,
49- NoInfer < TError > ,
50- InfiniteData <
51- ActualData < NoInfer < TResponse > , NoInfer < TData > , NoInfer < TErrorResponse > > ,
52- Partial < NoInfer < TRequest > >
53- > ,
54- ActualResponse < NoInfer < TResponse > , NoInfer < TErrorResponse > > ,
55- DataSourceKey ,
56- Partial < NoInfer < TRequest > >
57- > ,
58- ResultWrapper <
59- InfiniteQueryObserverResult <
60- InfiniteData <
61- ActualData < NoInfer < TResponse > , NoInfer < TData > , NoInfer < TErrorResponse > > ,
62- Partial < NoInfer < TRequest > >
63- > ,
64- NoInfer < TError >
65- > ,
66- NoInfer < TRequest > ,
67- NoInfer < TResponse > ,
68- NoInfer < TData > ,
69- NoInfer < TError > ,
70- NoInfer < TErrorResponse >
32+ export type InfiniteQueryDataSource < TParams , TRequest , TResponse , TData , TError > = DataSource <
33+ QueryDataSourceContext ,
34+ TParams ,
35+ TRequest ,
36+ TResponse ,
37+ TData ,
38+ TError ,
39+ InfiniteQueryObserverExtendedOptions <
40+ NoInfer < TResponse > ,
41+ NoInfer < TError > ,
42+ InfiniteData < ActualData < NoInfer < TData > , NoInfer < TResponse > > , Partial < TRequest > > ,
43+ NoInfer < TResponse > ,
44+ DataSourceKey ,
45+ Partial < NoInfer < TRequest > >
46+ > ,
47+ ResultWrapper <
48+ InfiniteQueryObserverResult <
49+ InfiniteData < ActualData < NoInfer < TData > , NoInfer < TResponse > > , Partial < TRequest > > ,
50+ NoInfer < TError >
7151 > ,
72- QueryFunctionContext < DataSourceKey , Partial < NoInfer < TRequest > > >
73- > & {
74- type : 'infinite' ;
75- next : (
76- lastPage : ActualResponse < NoInfer < TResponse > , NoInfer < TErrorResponse > > ,
77- allPages : Array < ActualResponse < NoInfer < TResponse > , NoInfer < TErrorResponse > > > ,
78- ) => Partial < NoInfer < TRequest > > | undefined | null ;
79- prev ?: (
80- firstPage : ActualResponse < NoInfer < TResponse > , NoInfer < TErrorResponse > > ,
81- allPages : Array < ActualResponse < NoInfer < TResponse > , NoInfer < TErrorResponse > > > ,
82- ) => Partial < NoInfer < TRequest > > | undefined | null ;
83- } ;
52+ NoInfer < TRequest > ,
53+ NoInfer < TResponse > ,
54+ NoInfer < TData > ,
55+ NoInfer < TError >
56+ > ,
57+ QueryFunctionContext < DataSourceKey , Partial < NoInfer < TRequest > > >
58+ > & {
59+ type : 'infinite' ;
60+ next : (
61+ lastPage : NoInfer < TResponse > ,
62+ allPages : NoInfer < TResponse > [ ] ,
63+ ) => Partial < NoInfer < TRequest > > | null | undefined ;
64+ prev ?: (
65+ firstPage : NoInfer < TResponse > ,
66+ allPages : NoInfer < TResponse > [ ] ,
67+ ) => Partial < NoInfer < TRequest > > | null | undefined ;
68+ } ;
8469
8570// eslint-disable-next-line @typescript-eslint/no-explicit-any
86- export type AnyInfiniteQueryDataSource = InfiniteQueryDataSource < any , any , any , any , any , any > ;
71+ export type AnyInfiniteQueryDataSource = InfiniteQueryDataSource < any , any , any , any , any > ;
8772
8873// It is used instead of `Partial<DataSourceRequest<TDataSource>>` because TS can't calculate type
8974// eslint-disable-next-line @typescript-eslint/no-explicit-any
9075export type AnyPageParam = Partial < any > ;
9176
92- type ResultWrapper < TResult , TRequest , TResponse , TData , TError , TErrorResponse > =
77+ type ResultWrapper < TResult , TRequest , TResponse , TData , TError > =
9378 TResult extends InfiniteQueryObserverResult <
94- InfiniteData < ActualData < TResponse , TData , TErrorResponse > , Partial < TRequest > > ,
79+ InfiniteData < ActualData < TData , TResponse > , Partial < TRequest > > ,
9580 TError
9681 >
9782 ? Overwrite <
9883 TResult ,
9984 {
10085 status : DataLoaderStatus ;
101- data : Array < FlatArray < Array < ActualData < TResponse , TData , TErrorResponse > > , 1 > > ;
86+ data : Array < FlatArray < Array < ActualData < TData , TResponse > > , 1 > > ;
10287 }
10388 > & {
10489 originalStatus : TResult [ 'status' ] ;
0 commit comments