dotansimha / graphql-code-generator

A tool for generating code based on a GraphQL schema and GraphQL operations (query/mutation/subscription), with flexible support for custom plugins.
https://the-guild.dev/graphql/codegen/
MIT License
10.86k stars 1.33k forks source link

Typescript-Resolver: custom `resolveInfo` type #2746

Closed ab-pm closed 4 years ago

ab-pm commented 5 years ago

Hi, we are using the Postgraphile library which not only uses a custom context but also has an extended resolveInfo argument. They do provide their own AugmentedGraphQLFieldResolver type but since it returns any it's not really compatible with the proper resolver types created by graphl-codegen.

Feature request: Could you please add another configuration option so that one could choose the type of the ResolveFn's info argument?

export type ResolverFn<TResult, TParent, TContext, TArgs> = (
  parent: TParent,
  args: TArgs,
  context: TContext,
  info: GraphQLResolveInfo
//      ^^^^^^^^^^^^^^^^^^ customise this
) => Promise<TResult> | TResult;
dotansimha commented 5 years ago

Implemented in 1.8.2.