Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit 6ac8c09

Browse files
committed
Rename type MaybePromise to PromiseOrValue
1 parent 28e4c29 commit 6ac8c09

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/index.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ import { renderGraphiQL } from './renderGraphiQL';
3333
type Request = IncomingMessage & { url: string };
3434

3535
type Response = ServerResponse & { json?: (data: unknown) => void };
36-
type MaybePromise<T> = Promise<T> | T;
36+
37+
type PromiseOrValue<T> = Promise<T> | T;
3738

3839
/**
3940
* Used to configure the graphqlHTTP middleware by providing a schema
@@ -47,8 +48,8 @@ export type Options =
4748
request: Request,
4849
response: Response,
4950
params?: GraphQLParams,
50-
) => MaybePromise<OptionsData>)
51-
| MaybePromise<OptionsData>;
51+
) => PromiseOrValue<OptionsData>)
52+
| PromiseOrValue<OptionsData>;
5253

5354
export interface OptionsData {
5455
/**
@@ -91,7 +92,7 @@ export interface OptionsData {
9192
* An optional function which will be used to execute instead of default `execute`
9293
* from `graphql-js`.
9394
*/
94-
customExecuteFn?: (args: ExecutionArgs) => MaybePromise<ExecutionResult>;
95+
customExecuteFn?: (args: ExecutionArgs) => PromiseOrValue<ExecutionResult>;
9596

9697
/**
9798
* An optional function which will be used to format any errors produced by
@@ -124,7 +125,7 @@ export interface OptionsData {
124125
*/
125126
extensions?: (
126127
info: RequestInfo,
127-
) => MaybePromise<undefined | { [key: string]: unknown }>;
128+
) => PromiseOrValue<undefined | { [key: string]: unknown }>;
128129

129130
/**
130131
* A boolean to optionally enable GraphiQL mode.

0 commit comments

Comments
 (0)