diff --git a/integrationTests/ts/basic-test.ts b/integrationTests/ts/basic-test.ts index 76b92a0c0a..a28bd840e7 100644 --- a/integrationTests/ts/basic-test.ts +++ b/integrationTests/ts/basic-test.ts @@ -9,10 +9,13 @@ const queryType: GraphQLObjectType = new GraphQLObjectType({ sayHi: { type: GraphQLString, args: { - who: { type: GraphQLString }, + who: { + type: GraphQLString, + defaultValue: 'World', + }, }, - resolve(_root, args) { - return 'Hello ' + (args.who ?? 'World'); + resolve(_root, args: { who: string }) { + return 'Hello ' + args.who; }, }, }), diff --git a/src/type/definition.ts b/src/type/definition.ts index b7ca3ce36c..ed658a8fc7 100644 --- a/src/type/definition.ts +++ b/src/type/definition.ts @@ -962,7 +962,7 @@ export type GraphQLIsTypeOfFn = ( export type GraphQLFieldResolver< TSource, TContext, - TArgs = { [argument: string]: any }, + TArgs = any, TResult = unknown, > = ( source: TSource, @@ -996,19 +996,11 @@ export interface GraphQLResolveInfo { * We've provided these template arguments because this is an open type and * you may find them useful. */ -export interface GraphQLFieldExtensions< - _TSource, - _TContext, - _TArgs = { [argName: string]: any }, -> { +export interface GraphQLFieldExtensions<_TSource, _TContext, _TArgs = any> { [attributeName: string]: unknown; } -export interface GraphQLFieldConfig< - TSource, - TContext, - TArgs = { [argument: string]: any }, -> { +export interface GraphQLFieldConfig { description?: Maybe; type: GraphQLOutputType; args?: GraphQLFieldConfigArgumentMap; @@ -1049,11 +1041,7 @@ export type GraphQLFieldConfigMap = ObjMap< GraphQLFieldConfig >; -export interface GraphQLField< - TSource, - TContext, - TArgs = { [argument: string]: any }, -> { +export interface GraphQLField { name: string; description: Maybe; type: GraphQLOutputType;