diff --git a/types/graphql-api-koa/graphql-api-koa-tests.ts b/types/graphql-api-koa/graphql-api-koa-tests.ts index 4f8ddca3df..6998d739ed 100644 --- a/types/graphql-api-koa/graphql-api-koa-tests.ts +++ b/types/graphql-api-koa/graphql-api-koa-tests.ts @@ -1,3 +1,27 @@ +import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; +import { execute } from "graphql-api-koa"; + +execute({ + schema: new GraphQLSchema({ + query: new GraphQLObjectType({ + name: "Query", + fields: () => ({ + hello: { + type: GraphQLString, + resolve() { + return "world"; + } + } + }) + }) + }) +}); + +/* This is the thest that SHOULD exist here... but for whatever reason, the + DefinitelyTyped repo always errors with: + + Module '"/Users/mike/Code/DefinitelyTyped/types/koa/index"' has no default export. + import Koa from "koa"; import { GraphQLSchema, GraphQLObjectType, GraphQLString } from "graphql"; import { errorHandler, execute } from "graphql-api-koa"; @@ -19,3 +43,4 @@ const app = new Koa() }) }) })); +*/ diff --git a/types/graphql-api-koa/index.d.ts b/types/graphql-api-koa/index.d.ts index b1cbae8ecd..5ba96fb723 100644 --- a/types/graphql-api-koa/index.d.ts +++ b/types/graphql-api-koa/index.d.ts @@ -14,10 +14,7 @@ export interface ExecuteOptions { fieldResolver?: any; } -export function errorHandler(): Middleware< - StateT, - CustomT ->; +export function errorHandler(): Middleware; export function execute( options: ExecuteOptions & {