Skip to content

execute: Convert ExecutionResult to be an exact object #2232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/execution/execute.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,10 @@ export type ExecutionContext = {|
* - `errors` is included when any errors occurred as a non-empty array.
* - `data` is the result of a successful execution of the query.
*/
export type ExecutionResult = {
export type ExecutionResult = {|
errors?: $ReadOnlyArray<GraphQLError>,
data?: ObjMap<mixed> | null,
...
};
|};

export type ExecutionArgs = {|
schema: GraphQLSchema,
Expand Down Expand Up @@ -181,7 +180,7 @@ export function execute(
});
}

function executeImpl(args: ExecutionArgs): ExecutionResult {
function executeImpl(args: ExecutionArgs): PromiseOrValue<ExecutionResult> {
const {
schema,
document,
Expand Down Expand Up @@ -232,7 +231,7 @@ function executeImpl(args: ExecutionArgs): ExecutionResult {
function buildResponse(
exeContext: ExecutionContext,
data: PromiseOrValue<ObjMap<mixed> | null>,
): ExecutionResult {
): PromiseOrValue<ExecutionResult> {
if (isPromise(data)) {
return data.then(resolved => buildResponse(exeContext, resolved));
}
Expand Down