mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
* Allow passing arbitrary TArgs to all utilities I'm facing an issue when using `graphql-resolvers` along with `graphqlgen` (for generating resolver types: https://github.com/prisma/graphqlgen). I get correct generated types from `graphqlgen`, but when I try to create a resolver using `combineResolvers`, I get a type error. Here is an example: ```js contest: combineResolvers(authHelpers.isAuthenticated, contestResolver) ``` The snippet above gives me this typescript error: ``` Types of parameters 'args' and 'args' are incompatible. Property 'id' is missing in type 'TArgs' but required in type 'ArgsContest'. ``` Where my `contestResolver` has the type `(parent: undefined, args: QueryResolvers.ArgsContest, ctx: Context, info: GraphQLResolveInfo) => Contest | Promise<Contest>`. Where `ArgsContests` is ``` export interface ArgsContest { id: string; } ``` And my `isAuthenticated` resolver has type `(parent: any, args: any, { me }: Context) => ForbiddenError | undefined`. Since right now I have no way of passing my own `TArgs` I have no other way but to ignore the error. With this PR I introduce the ability to pass a generic `TArgs` of my liking that let's me make typescript happy when using `graphqlgen` generated types. If no generic for that argument is passed, then `TArgsDefault` is used, which is equivalent to what the previous typings had. * Add myself to the contributors list. Forgot to add myself in the first commit. * Fix contributors list Made a mistake adding myself to the list. * fixing contributors list For some reason it did not like the multi-line version either. * correct contributors * fix linting errors, update graphql-tools * format type definitions