Skip to content

Commit

Permalink
TS integration test: add check for possibility to refine extension ty…
Browse files Browse the repository at this point in the history
…pes (#3007)
  • Loading branch information
IvanGoncharov committed Mar 30, 2021
1 parent 5974fef commit 8352543
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions integrationTests/ts/index.ts
Expand Up @@ -17,13 +17,15 @@ declare module 'graphql' {
interface GraphQLObjectTypeExtensions<_TSource = any, _TContext = any> {
someObjectExtension?: SomeExtension;
}

interface GraphQLFieldExtensions<
_TSource,
_TContext,
_TArgs = { [argName: string]: any }
> {
someFieldExtension?: SomeExtension;
}

interface GraphQLArgumentExtensions {
someArgumentExtension?: SomeExtension;
}
Expand Down Expand Up @@ -57,6 +59,15 @@ const schema: GraphQLSchema = new GraphQLSchema({
query: queryType,
});

function checkExtensionTypes(_test: SomeExtension | null | undefined) {}

checkExtensionTypes(queryType?.extensions?.someObjectExtension);

const sayHiField = queryType?.getFields()?.sayHi;
checkExtensionTypes(sayHiField?.extensions?.someFieldExtension);

checkExtensionTypes(sayHiField?.args?.[0]?.extensions?.someArgumentExtension);

const result: ExecutionResult = graphqlSync({
schema,
source: `
Expand Down

0 comments on commit 8352543

Please sign in to comment.