Skip to content

Commit

Permalink
fix: unbound-method lint error by using arrow function syntax for fns…
Browse files Browse the repository at this point in the history
… declared on the ObservableQueryFields interface (#11558)
  • Loading branch information
alessbell authored Feb 5, 2024
1 parent 7e3841a commit 8cba16f
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 59 deletions.
16 changes: 8 additions & 8 deletions .api-reports/api-report-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -1368,19 +1368,19 @@ class ObservableQuery<TData = any, TVariables extends OperationVariables = Opera

// @public (undocumented)
export interface ObservableQueryFields<TData, TVariables extends OperationVariables> {
fetchMore<TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
fetchMore: <TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
updateQuery?: (previousQueryResult: TData, options: {
fetchMoreResult: TFetchData;
variables: TFetchVars;
}) => TData;
}): Promise<ApolloQueryResult<TFetchData>>;
refetch(variables?: Partial<TVariables>): Promise<ApolloQueryResult<TData>>;
}) => Promise<ApolloQueryResult<TFetchData>>;
refetch: (variables?: Partial<TVariables>) => Promise<ApolloQueryResult<TData>>;
// @internal (undocumented)
reobserve(newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus): Promise<ApolloQueryResult<TData>>;
startPolling(pollInterval: number): void;
stopPolling(): void;
subscribeToMore<TSubscriptionData = TData, TSubscriptionVariables extends OperationVariables = TVariables>(options: SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData>): () => void;
updateQuery<TVars extends OperationVariables = TVariables>(mapFn: (previousQueryResult: TData, options: Pick<WatchQueryOptions<TVars, TData>, "variables">) => TData): void;
reobserve: (newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus) => Promise<ApolloQueryResult<TData>>;
startPolling: (pollInterval: number) => void;
stopPolling: () => void;
subscribeToMore: <TSubscriptionData = TData, TSubscriptionVariables extends OperationVariables = TVariables>(options: SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData>) => () => void;
updateQuery: <TVars extends OperationVariables = TVariables>(mapFn: (previousQueryResult: TData, options: Pick<WatchQueryOptions<TVars, TData>, "variables">) => TData) => void;
variables: TVariables | undefined;
}

Expand Down
16 changes: 8 additions & 8 deletions .api-reports/api-report-react_components.md
Original file line number Diff line number Diff line change
Expand Up @@ -1144,19 +1144,19 @@ class ObservableQuery<TData = any, TVariables extends OperationVariables = Opera

// @public (undocumented)
interface ObservableQueryFields<TData, TVariables extends OperationVariables> {
fetchMore<TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
fetchMore: <TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
updateQuery?: (previousQueryResult: TData, options: {
fetchMoreResult: TFetchData;
variables: TFetchVars;
}) => TData;
}): Promise<ApolloQueryResult<TFetchData>>;
refetch(variables?: Partial<TVariables>): Promise<ApolloQueryResult<TData>>;
}) => Promise<ApolloQueryResult<TFetchData>>;
refetch: (variables?: Partial<TVariables>) => Promise<ApolloQueryResult<TData>>;
// @internal (undocumented)
reobserve(newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus): Promise<ApolloQueryResult<TData>>;
startPolling(pollInterval: number): void;
stopPolling(): void;
subscribeToMore<TSubscriptionData = TData, TSubscriptionVariables extends OperationVariables = TVariables>(options: SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData>): () => void;
updateQuery<TVars extends OperationVariables = TVariables>(mapFn: (previousQueryResult: TData, options: Pick<WatchQueryOptions<TVars, TData>, "variables">) => TData): void;
reobserve: (newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus) => Promise<ApolloQueryResult<TData>>;
startPolling: (pollInterval: number) => void;
stopPolling: () => void;
subscribeToMore: <TSubscriptionData = TData, TSubscriptionVariables extends OperationVariables = TVariables>(options: SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData>) => () => void;
updateQuery: <TVars extends OperationVariables = TVariables>(mapFn: (previousQueryResult: TData, options: Pick<WatchQueryOptions<TVars, TData>, "variables">) => TData) => void;
variables: TVariables | undefined;
}

Expand Down
16 changes: 8 additions & 8 deletions .api-reports/api-report-react_context.md
Original file line number Diff line number Diff line change
Expand Up @@ -1101,19 +1101,19 @@ class ObservableQuery<TData = any, TVariables extends OperationVariables = Opera

// @public (undocumented)
interface ObservableQueryFields<TData, TVariables extends OperationVariables> {
fetchMore<TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
fetchMore: <TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
updateQuery?: (previousQueryResult: TData, options: {
fetchMoreResult: TFetchData;
variables: TFetchVars;
}) => TData;
}): Promise<ApolloQueryResult<TFetchData>>;
refetch(variables?: Partial<TVariables>): Promise<ApolloQueryResult<TData>>;
}) => Promise<ApolloQueryResult<TFetchData>>;
refetch: (variables?: Partial<TVariables>) => Promise<ApolloQueryResult<TData>>;
// @internal (undocumented)
reobserve(newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus): Promise<ApolloQueryResult<TData>>;
startPolling(pollInterval: number): void;
stopPolling(): void;
subscribeToMore<TSubscriptionData = TData, TSubscriptionVariables extends OperationVariables = TVariables>(options: SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData>): () => void;
updateQuery<TVars extends OperationVariables = TVariables>(mapFn: (previousQueryResult: TData, options: Pick<WatchQueryOptions<TVars, TData>, "variables">) => TData): void;
reobserve: (newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus) => Promise<ApolloQueryResult<TData>>;
startPolling: (pollInterval: number) => void;
stopPolling: () => void;
subscribeToMore: <TSubscriptionData = TData, TSubscriptionVariables extends OperationVariables = TVariables>(options: SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData>) => () => void;
updateQuery: <TVars extends OperationVariables = TVariables>(mapFn: (previousQueryResult: TData, options: Pick<WatchQueryOptions<TVars, TData>, "variables">) => TData) => void;
variables: TVariables | undefined;
}

Expand Down
16 changes: 8 additions & 8 deletions .api-reports/api-report-react_hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -1313,19 +1313,19 @@ class ObservableQuery<TData = any, TVariables extends OperationVariables = Opera

// @public (undocumented)
interface ObservableQueryFields<TData, TVariables extends OperationVariables> {
fetchMore<TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
fetchMore: <TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
updateQuery?: (previousQueryResult: TData, options: {
fetchMoreResult: TFetchData;
variables: TFetchVars;
}) => TData;
}): Promise<ApolloQueryResult<TFetchData>>;
refetch(variables?: Partial<TVariables>): Promise<ApolloQueryResult<TData>>;
}) => Promise<ApolloQueryResult<TFetchData>>;
refetch: (variables?: Partial<TVariables>) => Promise<ApolloQueryResult<TData>>;
// @internal (undocumented)
reobserve(newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus): Promise<ApolloQueryResult<TData>>;
startPolling(pollInterval: number): void;
stopPolling(): void;
subscribeToMore<TSubscriptionData = TData, TSubscriptionVariables extends OperationVariables = TVariables>(options: SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData>): () => void;
updateQuery<TVars extends OperationVariables = TVariables>(mapFn: (previousQueryResult: TData, options: Pick<WatchQueryOptions<TVars, TData>, "variables">) => TData): void;
reobserve: (newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus) => Promise<ApolloQueryResult<TData>>;
startPolling: (pollInterval: number) => void;
stopPolling: () => void;
subscribeToMore: <TSubscriptionData = TData, TSubscriptionVariables extends OperationVariables = TVariables>(options: SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData>) => () => void;
updateQuery: <TVars extends OperationVariables = TVariables>(mapFn: (previousQueryResult: TData, options: Pick<WatchQueryOptions<TVars, TData>, "variables">) => TData) => void;
variables: TVariables | undefined;
}

Expand Down
16 changes: 8 additions & 8 deletions .api-reports/api-report-react_ssr.md
Original file line number Diff line number Diff line change
Expand Up @@ -1086,19 +1086,19 @@ class ObservableQuery<TData = any, TVariables extends OperationVariables = Opera

// @public (undocumented)
interface ObservableQueryFields<TData, TVariables extends OperationVariables> {
fetchMore<TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
fetchMore: <TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
updateQuery?: (previousQueryResult: TData, options: {
fetchMoreResult: TFetchData;
variables: TFetchVars;
}) => TData;
}): Promise<ApolloQueryResult<TFetchData>>;
refetch(variables?: Partial<TVariables>): Promise<ApolloQueryResult<TData>>;
}) => Promise<ApolloQueryResult<TFetchData>>;
refetch: (variables?: Partial<TVariables>) => Promise<ApolloQueryResult<TData>>;
// @internal (undocumented)
reobserve(newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus): Promise<ApolloQueryResult<TData>>;
startPolling(pollInterval: number): void;
stopPolling(): void;
subscribeToMore<TSubscriptionData = TData, TSubscriptionVariables extends OperationVariables = TVariables>(options: SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData>): () => void;
updateQuery<TVars extends OperationVariables = TVariables>(mapFn: (previousQueryResult: TData, options: Pick<WatchQueryOptions<TVars, TData>, "variables">) => TData): void;
reobserve: (newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus) => Promise<ApolloQueryResult<TData>>;
startPolling: (pollInterval: number) => void;
stopPolling: () => void;
subscribeToMore: <TSubscriptionData = TData, TSubscriptionVariables extends OperationVariables = TVariables>(options: SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData>) => () => void;
updateQuery: <TVars extends OperationVariables = TVariables>(mapFn: (previousQueryResult: TData, options: Pick<WatchQueryOptions<TVars, TData>, "variables">) => TData) => void;
variables: TVariables | undefined;
}

Expand Down
16 changes: 8 additions & 8 deletions .api-reports/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -1860,19 +1860,19 @@ export class ObservableQuery<TData = any, TVariables extends OperationVariables

// @public (undocumented)
export interface ObservableQueryFields<TData, TVariables extends OperationVariables> {
fetchMore<TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
fetchMore: <TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
updateQuery?: (previousQueryResult: TData, options: {
fetchMoreResult: TFetchData;
variables: TFetchVars;
}) => TData;
}): Promise<ApolloQueryResult<TFetchData>>;
refetch(variables?: Partial<TVariables>): Promise<ApolloQueryResult<TData>>;
}) => Promise<ApolloQueryResult<TFetchData>>;
refetch: (variables?: Partial<TVariables>) => Promise<ApolloQueryResult<TData>>;
// @internal (undocumented)
reobserve(newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus): Promise<ApolloQueryResult<TData>>;
startPolling(pollInterval: number): void;
stopPolling(): void;
subscribeToMore<TSubscriptionData = TData, TSubscriptionVariables extends OperationVariables = TVariables>(options: SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData>): () => void;
updateQuery<TVars extends OperationVariables = TVariables>(mapFn: (previousQueryResult: TData, options: Pick<WatchQueryOptions<TVars, TData>, "variables">) => TData): void;
reobserve: (newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus) => Promise<ApolloQueryResult<TData>>;
startPolling: (pollInterval: number) => void;
stopPolling: () => void;
subscribeToMore: <TSubscriptionData = TData, TSubscriptionVariables extends OperationVariables = TVariables>(options: SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData>) => () => void;
updateQuery: <TVars extends OperationVariables = TVariables>(mapFn: (previousQueryResult: TData, options: Pick<WatchQueryOptions<TVars, TData>, "variables">) => TData) => void;
variables: TVariables | undefined;
}

Expand Down
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

0 comments on commit 8cba16f

Please sign in to comment.