From 6ac8c0973a07efbe3d4b1995924f017f0904b091 Mon Sep 17 00:00:00 2001 From: Yaroslav Kukytsyak Date: Sat, 10 Apr 2021 22:01:02 +0200 Subject: [PATCH] Rename type MaybePromise to PromiseOrValue --- src/index.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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.