Skip to content

Commit

Permalink
[Federation] Add queryHash to GraphQLExecutor
Browse files Browse the repository at this point in the history
Currently due to core-package not allowing queryHash

You have the following error when building an ApolloGateway with Typescript.
Property 'executor' in type 'ApolloGateway' is not assignable to the same property in base type 'GraphQLService'.
  Type '<TContext>(requestContext: WithRequired<GraphQLRequestContext<TContext>, "document" | "operation" | "queryHash">) => Promise<GraphQLExecutionResult>' is not assignable to type 'GraphQLExecutor<Record<string, any>>'.
    Types of parameters 'requestContext' and 'requestContext' are incompatible.
      Type 'WithRequired<GraphQLRequestContext<Record<string, any>>, "document" | "operationName" | "operation">' is not assignable to type 'WithRequired<GraphQLRequestContext<Record<string, any>>, "document" | "operation" | "queryHash">'.
        Type 'WithRequired<GraphQLRequestContext<Record<string, any>>, "document" | "operationName" | "operation">' is not assignable to type 'Required<Pick<GraphQLRequestContext<Record<string, any>>, "document" | "operation" | "queryHash">>'.
          Property 'queryHash' is optional in type 'GraphQLRequestContext<Record<string, any>> & Required<Pick<GraphQLRequestContext<Record<string, any>>, "document" | "operationName" | "operation">>' but required in type 'Required<Pick<GraphQLRequestContext<Record<string, any>>, "document" | "operation" | "queryHash">>'.ts(2416)

By allowing queryHash this should be fixed.
  • Loading branch information
Pruxis authored Jun 11, 2019
1 parent def2a25 commit d43e520
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/apollo-server-core/src/requestPipelineAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class InvalidGraphQLRequestError extends Error {}
export type GraphQLExecutor<TContext = Record<string, any>> = (
requestContext: WithRequired<
GraphQLRequestContext<TContext>,
'document' | 'operationName' | 'operation'
'document' | 'operationName' | 'operation' | 'queryHash'
>,
) => ValueOrPromise<GraphQLExecutionResult>;

Expand Down

0 comments on commit d43e520

Please sign in to comment.