diff --git a/src/index.ts b/src/index.ts index ba6210cc..2e2c29c8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -33,7 +33,8 @@ import { renderGraphiQL } from './renderGraphiQL'; type Request = IncomingMessage & { url: string }; type Response = ServerResponse & { json?: (data: unknown) => void }; -type MaybePromise = Promise | T; + +type PromiseOrValue = Promise | T; /** * Used to configure the graphqlHTTP middleware by providing a schema @@ -47,8 +48,8 @@ export type Options = request: Request, response: Response, params?: GraphQLParams, - ) => MaybePromise) - | MaybePromise; + ) => PromiseOrValue) + | PromiseOrValue; export interface OptionsData { /** @@ -91,7 +92,7 @@ export interface OptionsData { * An optional function which will be used to execute instead of default `execute` * from `graphql-js`. */ - customExecuteFn?: (args: ExecutionArgs) => MaybePromise; + customExecuteFn?: (args: ExecutionArgs) => PromiseOrValue; /** * An optional function which will be used to format any errors produced by @@ -124,7 +125,7 @@ export interface OptionsData { */ extensions?: ( info: RequestInfo, - ) => MaybePromise; + ) => PromiseOrValue; /** * A boolean to optionally enable GraphiQL mode.