dotansimha / dotansimha/graphql-code-generator
Support for Args and related module types in GraphQL Module Resolvers
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 23
Description
When I use the graphql-modules preset, I don't get typings like MutationCreateAuthMethodsArgs in the module generated file but I do get it in the overall codegen file
For eg: I have this in overall codegen file:
```ts
/** Auth Method Mutations */
export type MutationCreateAuthMethodsArgs = {
input?: Maybe>>;
};
```
But not in the module file. I just have this:
```ts
export type createAuthMethodsInput = Pick;
```
I use the type in the provider like this:
```ts
async create(context: GraphQLModules.Context, args: GQLTypes.MutationCreateAuthMethodsArgs) {
}
```
but not able to do that now.
The typing works well in resolvers, but this is what I do in my resolver:
```ts
createAuthMethods: async (_parent, args, context: GraphQLModules.Context) => {
let result = await context.injector.get(AuthMethod).create(context, args);
return result;
},
```
Thanks. Will use the global typed file as of now.
**CC:** @dotansimha
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.