apollo-feature-requests icon indicating copy to clipboard operation
apollo-feature-requests copied to clipboard

More Specific Context Types

Open indeediansbrett opened this issue 4 years ago • 0 comments

The context type specified for context is almost always either any or Record<string,any>. Asking for an optional generic to help enforce context shapes. Below find an example from ApolloClient.query. Propose to change these interfaces to use an optional generic parameter:

export interface QueryOptions<TVariables = OperationVariables, TData = any> {
    ...
    context?: any;
    ...
}
export interface QueryOptions<TVariables = OperationVariables, TData = any, TContext = any> {
    ...
    context?: TContext;
    ...
}

indeediansbrett avatar Jul 21 '21 00:07 indeediansbrett