prisma-labs/graphqlgen

Generated resolver types have typo "resolver" instead of "resolve"

rlux opened this issue · 3 comments

rlux commented

Description

The generated resolver types contain a misspelling, when using fragments. Everything works fine when the resolver is a simple function, but in case that I need fragments, the resolve function is misspelled as "resolver" (This also makes it incompatible with the IResolver type from graphql). Using the key "resolver" makes the typescript compiler happy, but the resolve function is never called because of the wrong name.

Example generated code:
export type MyTypeResolver = | ((parent: MyType, args: {}, ctx: Context, info: GraphQLResolveInfo) => string | Promise<string>) | { fragment: string; resolver: (parent: MyType, args: {}, ctx: Context, info: GraphQLResolveInfo) => string | Promise<string>; };

Steps to reproduce

Use any graphql schema and generate the types with ./graphqlgen

Expected results

The generated types should use the key "resolve".

Actual results

The generated types use the key "resolver".

Versions

  • graphqlgen: 0.6.0-rc5

Closed by 8ff3283

Hey @rlux give 0.6.0-rc6 a try.

rlux commented

@jasonkuhrt That was fast, thanks! It works great now :)