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

Commit c0abe98

Browse files
committed
Rename type MaybePromise to PromiseOrValue
1 parent 2882357 commit c0abe98

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
@@ -36,7 +36,8 @@ import { renderGraphiQL } from './renderGraphiQL';
3636
type Request = IncomingMessage & { url: string };
3737

3838
type Response = ServerResponse & { json?: (data: unknown) => void };
39-
type MaybePromise<T> = Promise<T> | T;
39+
40+
type PromiseOrValue<T> = Promise<T> | T;
4041

4142
/**
4243
* Used to configure the graphqlHTTP middleware by providing a schema
@@ -50,8 +51,8 @@ export type Options =
5051
request: Request,
5152
response: Response,
5253
params?: GraphQLParams,
53-
) => MaybePromise<OptionsData>)
54-
| MaybePromise<OptionsData>;
54+
) => PromiseOrValue<OptionsData>)
55+
| PromiseOrValue<OptionsData>;
5556

5657
export interface OptionsData {
5758
/**
@@ -94,7 +95,7 @@ export interface OptionsData {
9495
* An optional function which will be used to execute instead of default `execute`
9596
* from `graphql-js`.
9697
*/
97-
customExecuteFn?: (args: ExecutionArgs) => MaybePromise<ExecutionResult>;
98+
customExecuteFn?: (args: ExecutionArgs) => PromiseOrValue<ExecutionResult>;
9899

99100
/**
100101
* An optional function which will be used to format any errors produced by
@@ -127,7 +128,7 @@ export interface OptionsData {
127128
*/
128129
extensions?: (
129130
info: RequestInfo,
130-
) => MaybePromise<undefined | { [key: string]: unknown }>;
131+
) => PromiseOrValue<undefined | { [key: string]: unknown }>;
131132

132133
/**
133134
* A boolean to optionally enable GraphiQL mode.

0 commit comments

Comments
 (0)