Skip to content

Commit cbb7de9

Browse files
committed
Ensure ExecutionResult is defined (graphql/graphql.github.io#1049)
1 parent e4c0fe4 commit cbb7de9

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

website/pages/execution.mdx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,14 @@ export function execute(
4040

4141
type MaybePromise<T> = Promise<T> | T;
4242

43-
type ExecutionResult = {
44-
data: Object;
45-
errors?: GraphQLError[];
46-
};
43+
interface ExecutionResult<
44+
TData = ObjMap<unknown>,
45+
TExtensions = ObjMap<unknown>,
46+
> {
47+
errors?: ReadonlyArray<GraphQLError>;
48+
data?: TData | null;
49+
extensions?: TExtensions;
50+
}
4751
```
4852

4953
Implements the "Evaluating requests" section of the GraphQL specification.

website/pages/graphql.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,15 @@ function graphql(
144144
variableValues?: { [key: string]: any },
145145
operationName?: string,
146146
): Promise<GraphQLResult>;
147+
148+
interface ExecutionResult<
149+
TData = ObjMap<unknown>,
150+
TExtensions = ObjMap<unknown>,
151+
> {
152+
errors?: ReadonlyArray<GraphQLError>;
153+
data?: TData | null;
154+
extensions?: TExtensions;
155+
}
147156
```
148157

149158
The `graphql` function lexes, parses, validates and executes a GraphQL request.

website/pages/type.mdx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,6 @@ const OddType = new GraphQLScalarType({
234234
return null;
235235
},
236236
});
237-
238-
function oddValue(value) {
239-
return value % 2 === 1 ? value : null;
240-
}
241237
```
242238
243239
### GraphQLObjectType

0 commit comments

Comments
 (0)