Skip to content

Commit 80750da

Browse files
committed
Document executeSync (#2941)
1 parent 16b3d01 commit 80750da

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

website/pages/execution.mdx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,25 @@ a GraphQLError will be thrown immediately explaining the invalid input.
5656
`ExecutionResult` represents the result of execution. `data` is the result of
5757
executing the query, `errors` is null if no errors occurred, and is a
5858
non-empty array if an error occurred.
59+
60+
### executeSync
61+
62+
```ts
63+
export function executeSync(
64+
schema: GraphQLSchema,
65+
documentAST: Document,
66+
rootValue?: mixed,
67+
contextValue?: mixed,
68+
variableValues?: { [key: string]: mixed },
69+
operationName?: string,
70+
): ExecutionResult;
71+
72+
type ExecutionResult = {
73+
data: Object;
74+
errors?: GraphQLError[];
75+
};
76+
```
77+
78+
This is a short-hand method that will call `execute` and when the response can
79+
be returned synchronously it will be returned, when a `Promise` is returned this
80+
method will throw an error.

0 commit comments

Comments
 (0)