I wondering if it possible to get a type of single resolver function generated by graphql-codegen
?
I also use graphql-modules
with graphql-modules-preset
. All of these libraries provide me a list of automatically generated types, but unfortunately I can't find a type of a single resolver function.
I would expected something like this:
const createRepository: CreateRepositoryMutationResolver = (parent, args, context, info) => {
// Code goes here
}
where all arguments of the function (parent
, args
, context
and info
) are strongly typed.
Instead, I could only find this way of providing types
const createRepository: ResolverFn<{}, MutationCreateRepositoryInput, GraphQLContext, GraphQLInfo> = (parent, args, context, info) => {
// Code goes here
}
I would like to skip this step where I need to fill in generics of ResolverFn
Any ideas?
P.S. If I declare all resolvers in single file, then types work as expected.
const resolvers: RepositoryModule.Resolvers = {
Mutations: {
createRepository: (parent, args, context, info) => {
// all types of all arguments work as expected
},
removeRepository: (parent, args, context, info) => {
// all types of all arguments work as expected
}
}
}
But I want to move each resolver into separate file