@@ -14,7 +14,7 @@ import type {
1414 ThunkObjMap ,
1515} from 'graphql' ;
1616
17- type MutationFn = ( object : any , ctx : any , info : GraphQLResolveInfo ) => unknown ;
17+ type MutationFn < TInput = any , TOutput = unknown , TContext = any > = ( object : TInput , ctx : TContext , info : GraphQLResolveInfo ) => TOutput ;
1818
1919/**
2020 * A description of a mutation consumable by mutationWithClientMutationId
@@ -30,22 +30,22 @@ type MutationFn = (object: any, ctx: any, info: GraphQLResolveInfo) => unknown;
3030 * input field, and it should return an Object with a key for each
3131 * output field. It may return synchronously, or return a Promise.
3232 */
33- interface MutationConfig {
33+ interface MutationConfig < TInput = any , TOutput = unknown , TContext = any > {
3434 name : string ;
3535 description ?: string ;
3636 deprecationReason ?: string ;
3737 extensions ?: GraphQLFieldExtensions < any , any > ;
3838 inputFields : ThunkObjMap < GraphQLInputFieldConfig > ;
39- outputFields : ThunkObjMap < GraphQLFieldConfig < any , any > > ;
40- mutateAndGetPayload : MutationFn ;
39+ outputFields : ThunkObjMap < GraphQLFieldConfig < TOutput , TContext > > ;
40+ mutateAndGetPayload : MutationFn < TInput , TOutput , TContext > ;
4141}
4242
4343/**
4444 * Returns a GraphQLFieldConfig for the mutation described by the
4545 * provided MutationConfig.
4646 */
47- export function mutationWithClientMutationId (
48- config : MutationConfig ,
47+ export function mutationWithClientMutationId < TInput = any , TOutput = unknown , TContext = any > (
48+ config : MutationConfig < TInput , TOutput , TContext > ,
4949) : GraphQLFieldConfig < unknown , unknown > {
5050 const { name, inputFields, outputFields, mutateAndGetPayload } = config ;
5151 const augmentedInputFields = ( ) => ( {
0 commit comments