question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeScript: Property 'mergeInfo' is missing in type 'GraphQLResolveInfo' but required in type '{ mergeInfo: MergeInfo; }

See original GitHub issue

I am using this library and for the last year I loved it. Now I am using it in a TypeScript GraphQL Server with @types/graphql-resolvers.

All my types are generated via graphql-codegen. Without combineResolvers, all types evaluate just fine. If I am using a combined resolver though, I get:

Type 'IFieldResolver<any, any, { courseId: COURSE; bundleId: BUNDLE; }>' is not assignable to type 'ResolverFn<any, {}, ResolverContext, RequireFields<MutationCreateFreeCourseArgs, "courseId" | "bundleId">> | StitchingResolver<...> | undefined'.
  Type 'IFieldResolver<any, any, { courseId: COURSE; bundleId: BUNDLE; }>' is not assignable to type 'ResolverFn<any, {}, ResolverContext, RequireFields<MutationCreateFreeCourseArgs, "courseId" | "bundleId">>'.
    Types of parameters 'info' and 'info' are incompatible.
      Type 'GraphQLResolveInfo' is not assignable to type 'GraphQLResolveInfo & { mergeInfo: MergeInfo; }'.
        Property 'mergeInfo' is missing in type 'GraphQLResolveInfo' but required in type '{ mergeInfo: MergeInfo; }'.ts(2322)
Interfaces.d.ts(59, 5): 'mergeInfo' is declared here.
gen-types.ts(288, 3): The expected type comes from property 'createFreeCourse' which is declared here on type 'WithIndex<{ _?: ResolverFn<any, {}, ResolverContext, {}> | StitchingResolver<any, {}, ResolverContext, {}> | undefined; ... 8 more ...; createAdminCourse?: ResolverFn<...> | ... 1 more ... | 

Whereas I think the crucial part is:

Property 'mergeInfo' is missing in type 'GraphQLResolveInfo' but required in type '{ mergeInfo: MergeInfo; }'.ts(2322)

Could it be that the 4th argument of a resolver isn’t evaluated in the TS version of this library?


Something related in another library: https://github.com/prisma-labs/graphql-middleware/pull/29/files

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
zaguiinicommented, May 21, 2020

Types have been published. Can you try it again?

1reaction
lucasconstantinocommented, Feb 4, 2020

@rwieruch are you TypeScript acknowledged? I’ve being using for a while, but I’m no expert. To give you context: this library has currently no typings at all, and I don’t even know where to start with typing cause this library has no direct relation with GraphQL. Take combineResolvers, for instance:

combineResolvers: (...args: any[]) => Promise<any>

The any[] is because this is precisely how this library works: whatever it takes in, it will manage to make available to the end of the cycle.

We could use generics an inference to help typing resolver implementations from whatever is arguments are passed into combineResolvers, but I’m not really sure how to accomplish that. I’m very open to PRs, though.

P.s.: a easy solution for you own case would be to create your own strict type definition… keep in mind this wouldn’t be a got fit for contributing, cause this varies a lot. context, for instance, is basically a black box for typing, no way we should interfere on how that is typed, or we would probably cause more trouble than gain.

Read more comments on GitHub >

github_iconTop Results From Across the Web

graphql-resolvers - Bountysource
TypeScript : Property 'mergeInfo' is missing in type 'GraphQLResolveInfo' but required in type '{ mergeInfo: MergeInfo; } $ 0.
Read more >
API Reference: graphql-tools - Apollo GraphQL Docs
GraphQL resolve info of the current resolver. Provides access to the subquery that starts at the current resolver. Also provides the info.mergeInfo.
Read more >
eclipse - svn property mergeinfo missing - Stack Overflow
I have a project with 2 branches let's say v1.1 en v1.2 (in the same svn repository). In v1.1 I modified 2 files...
Read more >
Basic Merging - SVN Book
Notice that we're using the caret ( ^ ) syntax to avoid having to type out the ... This tells you that the...
Read more >
Patch #18134: Issues with svn:mergeinfo property ... - Redmine
[rails-4.1 branch] r13443 rebase of rails-4.1 branch included rails-4.1 backport commits to trunk (in svn:mergeinfo only obviously): need to reverse-merge ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found