TypeScript: Property 'mergeInfo' is missing in type 'GraphQLResolveInfo' but required in type '{ mergeInfo: MergeInfo; }
See original GitHub issueI 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:
- Created 4 years ago
- Comments:8 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Types have been published. Can you try it again?
@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: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.