Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: unbound-method lint error by using arrow function syntax for fns declared on the ObservableQueryFields interface #11558

Merged
5 changes: 5 additions & 0 deletions .changeset/forty-rice-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@apollo/client": patch
---

Fix [`unbound-method`](https://github.com/apollographql/apollo-client/issues/11554) linter error on ObservableQuery methods exposed on useQuery's QueryResult object.
24 changes: 13 additions & 11 deletions src/react/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ export interface ObservableQueryFields<
TVariables extends OperationVariables,
> {
/** {@inheritDoc @apollo/client!QueryResultDocumentation#startPolling:member} */
startPolling(pollInterval: number): void;
startPolling: (pollInterval: number) => void;
/** {@inheritDoc @apollo/client!QueryResultDocumentation#stopPolling:member} */
stopPolling(): void;
stopPolling: () => void;
/** {@inheritDoc @apollo/client!QueryResultDocumentation#subscribeToMore:member} */
subscribeToMore<
subscribeToMore: <
TSubscriptionData = TData,
TSubscriptionVariables extends OperationVariables = TVariables,
>(
Expand All @@ -94,25 +94,27 @@ export interface ObservableQueryFields<
TSubscriptionVariables,
TSubscriptionData
>
): () => void;
) => () => void;
/** {@inheritDoc @apollo/client!QueryResultDocumentation#updateQuery:member} */
updateQuery<TVars extends OperationVariables = TVariables>(
updateQuery: <TVars extends OperationVariables = TVariables>(
mapFn: (
previousQueryResult: TData,
options: Pick<WatchQueryOptions<TVars, TData>, "variables">
) => TData
): void;
) => void;
/** {@inheritDoc @apollo/client!QueryResultDocumentation#refetch:member} */
refetch(variables?: Partial<TVariables>): Promise<ApolloQueryResult<TData>>;
refetch: (
variables?: Partial<TVariables>
) => Promise<ApolloQueryResult<TData>>;
/** @internal */
reobserve(
reobserve: (
newOptions?: Partial<WatchQueryOptions<TVariables, TData>>,
newNetworkStatus?: NetworkStatus
): Promise<ApolloQueryResult<TData>>;
) => Promise<ApolloQueryResult<TData>>;
/** {@inheritDoc @apollo/client!QueryResultDocumentation#variables:member} */
variables: TVariables | undefined;
/** {@inheritDoc @apollo/client!QueryResultDocumentation#fetchMore:member} */
fetchMore<
fetchMore: <
TFetchData = TData,
TFetchVars extends OperationVariables = TVariables,
>(
Expand All @@ -125,7 +127,7 @@ export interface ObservableQueryFields<
}
) => TData;
}
): Promise<ApolloQueryResult<TFetchData>>;
) => Promise<ApolloQueryResult<TFetchData>>;
}

export interface QueryResult<
Expand Down
Loading