Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

[typescript] updateQuery in FetchMoreOptions and SubscribeToMoreOptions is not typed #1920

Closed
alamothe opened this issue Apr 10, 2018 · 1 comment
Labels

Comments

@alamothe
Copy link

alamothe commented Apr 10, 2018

In GraphqlQueryControls:

export interface GraphqlQueryControls<TGraphQLVariables = OperationVariables> {
    error?: ApolloError;
    networkStatus: number;
    loading: boolean;
    variables: TGraphQLVariables;
    fetchMore: (fetchMoreOptions: FetchMoreQueryOptions & FetchMoreOptions) => Promise<ApolloQueryResult<any>>;
    refetch: (variables?: TGraphQLVariables) => Promise<ApolloQueryResult<any>>;
    startPolling: (pollInterval: number) => void;
    stopPolling: () => void;
    subscribeToMore: (options: SubscribeToMoreOptions) => () => void;
    updateQuery: (mapFn: (previousQueryResult: any, options: UpdateQueryOptions) => any) => void;
}
export declare type DataValue<TData, TGraphQLVariables = OperationVariables> = GraphqlQueryControls<TGraphQLVariables> & Partial<TData>;
export interface DataProps<TData, TGraphQLVariables = OperationVariables> {
    data: DataValue<TData, TGraphQLVariables>;
}

GraphqlQueryControls does not have TData as generic parameter. Same goes for FetchMoreOptions and SubscribeToMoreOptions.

At least, TData should be passed from GraphqlQueryControls to FetchMoreOptions and SubscribeToMoreOptions to type updateQuery callback's previous result

@alamothe alamothe changed the title [typescript] [typescript] updateQuery in FetchMoreOptions and SubscribeToMoreOptions is not typed Apr 10, 2018
@hwillson
Copy link
Member

This was addressed in #2525. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants