From dd32678ebffd5091bbe69183391ddeae1de32d6e Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Tue, 16 Feb 2021 16:35:58 +0200 Subject: [PATCH] TS: Enable integrations tests for extending `GraphQL*Extensions` types --- integrationTests/ts/index.ts | 12 ++++-------- src/type/definition.d.ts | 3 ++- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/integrationTests/ts/index.ts b/integrationTests/ts/index.ts index 6ef6bea8999..23402f543a6 100644 --- a/integrationTests/ts/index.ts +++ b/integrationTests/ts/index.ts @@ -13,17 +13,14 @@ const example: SomeExtension = { string: 'Meaning of life', }; -// FIXME: The following code block requires a version of TypeScript >= 3.2 -/* - declare module 'graphql' { - interface GraphQLObjectTypeExtensions { + interface GraphQLObjectTypeExtensions<_TSource = any, _TContext = any> { someObjectExtension?: SomeExtension; } interface GraphQLFieldExtensions< - TSource, - TContext, - TArgs = { [argName: string]: any } + _TSource, + _TContext, + _TArgs = { [argName: string]: any } > { someFieldExtension?: SomeExtension; } @@ -31,7 +28,6 @@ declare module 'graphql' { someArgumentExtension?: SomeExtension; } } -*/ const queryType: GraphQLObjectType = new GraphQLObjectType({ name: 'Query', diff --git a/src/type/definition.d.ts b/src/type/definition.d.ts index 457e756dd40..bad51828bdc 100644 --- a/src/type/definition.d.ts +++ b/src/type/definition.d.ts @@ -360,7 +360,8 @@ export interface GraphQLScalarTypeConfig { * We've provided these template arguments because this is an open type and * you may find them useful. */ -export interface GraphQLObjectTypeExtensions<_TSource = any, _TContext = any> { +// eslint-disable-next-line @typescript-eslint/no-unused-vars +export interface GraphQLObjectTypeExtensions { [attributeName: string]: any; }