Skip to content

Commit 5575152

Browse files
committed
fix: typings of MobxInfiniteQuery
1 parent 8344d0a commit 5575152

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

src/mobx-inifinite-query.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,16 @@ export class MobxInfiniteQuery<
4141
protected abortController: AbortController;
4242
protected queryClient: QueryClient | MobxQueryClient;
4343

44-
protected _result: InfiniteQueryObserverResult<InfiniteData<TData>, TError>;
44+
protected _result: InfiniteQueryObserverResult<
45+
InfiniteData<TData, TPageParam>,
46+
TError
47+
>;
4548
options: MobxInfiniteQueryOptions<TData, TError, TQueryKey, TPageParam>;
4649
queryObserver: InfiniteQueryObserver<
4750
TData,
4851
TError,
49-
InfiniteData<TData>,
50-
InfiniteData<TData>,
52+
InfiniteData<TData, TPageParam>,
53+
InfiniteData<TData, TPageParam>,
5154
TQueryKey,
5255
TPageParam
5356
>;
@@ -186,12 +189,12 @@ export class MobxInfiniteQuery<
186189

187190
setData(
188191
updater: Updater<
189-
NoInfer<InfiniteData<TData>> | undefined,
190-
NoInfer<InfiniteData<TData>> | undefined
192+
NoInfer<InfiniteData<TData, TPageParam>> | undefined,
193+
NoInfer<InfiniteData<TData, TPageParam>> | undefined
191194
>,
192195
options?: SetDataOptions,
193196
) {
194-
this.queryClient.setQueryData<InfiniteData<TData>>(
197+
this.queryClient.setQueryData<InfiniteData<TData, TPageParam>>(
195198
this.options.queryKey,
196199
updater,
197200
options,
@@ -259,7 +262,7 @@ export class MobxInfiniteQuery<
259262
*/
260263
private updateResult(
261264
nextResult: InfiniteQueryObserverResult<
262-
InfiniteData<TData, unknown>,
265+
InfiniteData<TData, TPageParam>,
263266
TError
264267
>,
265268
) {
@@ -287,7 +290,10 @@ export class MobxInfiniteQuery<
287290
}
288291

289292
onDone(
290-
onDoneCallback: (data: InfiniteData<TData>, payload: void) => void,
293+
onDoneCallback: (
294+
data: InfiniteData<TData, TPageParam>,
295+
payload: void,
296+
) => void,
291297
): void {
292298
reaction(
293299
() => !this._result.error && this._result.isSuccess,

src/mobx-inifinite-query.types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ export interface MobxInfiniteQueryOptions<
5050
> extends DefaultedInfiniteQueryObserverOptions<
5151
TData,
5252
TError,
53-
InfiniteData<TData>,
54-
InfiniteData<TData>,
53+
InfiniteData<TData, TPageParam>,
54+
InfiniteData<TData, TPageParam>,
5555
TQueryKey,
5656
TPageParam
5757
> {}

0 commit comments

Comments
 (0)