Skip to content

Commit 61ff0b8

Browse files
committed
fetchMore typing is duplicated from @apollo/client
Fixes #2346
1 parent c114cf2 commit 61ff0b8

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

.changeset/rare-ways-hunt.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'apollo-angular': patch
3+
---
4+
5+
`fetchMore` typing is duplicated from `@apollo/client`

packages/apollo-angular/src/query-ref.ts

+14-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ import { from, Observable } from 'rxjs';
22
import { NgZone } from '@angular/core';
33
import type {
44
ApolloQueryResult,
5+
FetchMoreQueryOptions,
6+
MaybeMasked,
57
ObservableQuery,
68
OperationVariables,
79
SubscribeToMoreOptions,
810
TypedDocumentNode,
11+
Unmasked,
912
} from '@apollo/client/core';
1013
import { NetworkStatus } from '@apollo/client/core';
1114
import { EmptyObject, WatchQueryOptions } from './types';
@@ -96,9 +99,17 @@ export class QueryRef<TData, TVariables extends OperationVariables = EmptyObject
9699
return this.obsQuery.refetch(variables);
97100
}
98101

99-
public fetchMore<TFetchVars extends OperationVariables = TVariables>(
100-
fetchMoreOptions: Parameters<ObservableQuery<TData, TFetchVars>['fetchMore']>[0],
101-
): ReturnType<ObservableQuery<TData, TFetchVars>['fetchMore']> {
102+
public fetchMore<TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(
103+
fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
104+
updateQuery?: (
105+
previousQueryResult: Unmasked<TData>,
106+
options: {
107+
fetchMoreResult: Unmasked<TFetchData>;
108+
variables: TFetchVars;
109+
},
110+
) => Unmasked<TData>;
111+
},
112+
): Promise<ApolloQueryResult<MaybeMasked<TFetchData>>> {
102113
return this.obsQuery.fetchMore(fetchMoreOptions);
103114
}
104115

0 commit comments

Comments
 (0)