Skip to content

Commit

Permalink
Ensure ExecutionResult is defined (graphql/graphql.github.io#1049)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Nov 2, 2024
1 parent e4c0fe4 commit cbb7de9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
12 changes: 8 additions & 4 deletions website/pages/execution.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ export function execute(

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

type ExecutionResult = {
data: Object;
errors?: GraphQLError[];
};
interface ExecutionResult<
TData = ObjMap<unknown>,
TExtensions = ObjMap<unknown>,
> {
errors?: ReadonlyArray<GraphQLError>;
data?: TData | null;
extensions?: TExtensions;
}
```

Implements the "Evaluating requests" section of the GraphQL specification.
Expand Down
9 changes: 9 additions & 0 deletions website/pages/graphql.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,15 @@ function graphql(
variableValues?: { [key: string]: any },
operationName?: string,
): Promise<GraphQLResult>;

interface ExecutionResult<
TData = ObjMap<unknown>,
TExtensions = ObjMap<unknown>,
> {
errors?: ReadonlyArray<GraphQLError>;
data?: TData | null;
extensions?: TExtensions;
}
```

The `graphql` function lexes, parses, validates and executes a GraphQL request.
Expand Down
4 changes: 0 additions & 4 deletions website/pages/type.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,6 @@ const OddType = new GraphQLScalarType({
return null;
},
});
function oddValue(value) {
return value % 2 === 1 ? value : null;
}
```
### GraphQLObjectType
Expand Down

0 comments on commit cbb7de9

Please sign in to comment.