Skip to content

Commit

Permalink
TS: Enable integrations tests for extending GraphQL*Extensions types
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Feb 18, 2021
1 parent 4e314be commit 091134d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
12 changes: 4 additions & 8 deletions integrationTests/ts/index.ts
Expand Up @@ -13,25 +13,21 @@ const example: SomeExtension = {
string: 'Meaning of life',
};

// FIXME: The following code block requires a version of TypeScript >= 3.2
/*
declare module 'graphql' {
interface GraphQLObjectTypeExtensions<TSource = any, TContext = any> {
interface GraphQLObjectTypeExtensions<_TSource = any, _TContext = any> {
someObjectExtension?: SomeExtension;
}
interface GraphQLFieldExtensions<
TSource,
TContext,
TArgs = { [argName: string]: any }
_TSource,
_TContext,
_TArgs = { [argName: string]: any }
> {
someFieldExtension?: SomeExtension;
}
interface GraphQLArgumentExtensions {
someArgumentExtension?: SomeExtension;
}
}
*/

const queryType: GraphQLObjectType = new GraphQLObjectType({
name: 'Query',
Expand Down
3 changes: 2 additions & 1 deletion src/type/definition.d.ts
Expand Up @@ -360,7 +360,8 @@ export interface GraphQLScalarTypeConfig<TInternal, TExternal> {
* 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<TSource = any, TContext = any> {
[attributeName: string]: any;
}

Expand Down

0 comments on commit 091134d

Please sign in to comment.