@@ -14,7 +14,7 @@ import type {
14
14
ThunkObjMap ,
15
15
} from 'graphql' ;
16
16
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 ;
18
18
19
19
/**
20
20
* A description of a mutation consumable by mutationWithClientMutationId
@@ -30,22 +30,22 @@ type MutationFn = (object: any, ctx: any, info: GraphQLResolveInfo) => unknown;
30
30
* input field, and it should return an Object with a key for each
31
31
* output field. It may return synchronously, or return a Promise.
32
32
*/
33
- interface MutationConfig {
33
+ interface MutationConfig < TInput = any , TOutput = unknown , TContext = any > {
34
34
name : string ;
35
35
description ?: string ;
36
36
deprecationReason ?: string ;
37
37
extensions ?: GraphQLFieldExtensions < any , any > ;
38
38
inputFields : ThunkObjMap < GraphQLInputFieldConfig > ;
39
- outputFields : ThunkObjMap < GraphQLFieldConfig < any , any > > ;
40
- mutateAndGetPayload : MutationFn ;
39
+ outputFields : ThunkObjMap < GraphQLFieldConfig < TOutput , TContext > > ;
40
+ mutateAndGetPayload : MutationFn < TInput , TOutput , TContext > ;
41
41
}
42
42
43
43
/**
44
44
* Returns a GraphQLFieldConfig for the mutation described by the
45
45
* provided MutationConfig.
46
46
*/
47
- export function mutationWithClientMutationId (
48
- config : MutationConfig ,
47
+ export function mutationWithClientMutationId < TInput = any , TOutput = unknown , TContext = any > (
48
+ config : MutationConfig < TInput , TOutput , TContext > ,
49
49
) : GraphQLFieldConfig < unknown , unknown > {
50
50
const { name, inputFields, outputFields, mutateAndGetPayload } = config ;
51
51
const augmentedInputFields = ( ) => ( {
0 commit comments