Skip to content
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

ExecutionResult: add 'extensions' field #2644

Merged
merged 1 commit into from Jun 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/execution/execute.d.ts
Expand Up @@ -43,11 +43,16 @@ export interface ExecutionContext {
*
* - `errors` is included when any errors occurred as a non-empty array.
* - `data` is the result of a successful execution of the query.
* - `extensions` is reserved for adding non-standard properties.
*/
export interface ExecutionResult<TData = { [key: string]: any }> {
export interface ExecutionResult<
TData = { [key: string]: any },
TExtensions = { [key: string]: any }
> {
errors?: ReadonlyArray<GraphQLError>;
// TS_SPECIFIC: TData. Motivation: https://github.com/graphql/graphql-js/pull/2490#issuecomment-639154229
data?: TData | null;
extensions?: TExtensions;
}

export interface ExecutionArgs {
Expand Down
2 changes: 2 additions & 0 deletions src/execution/execute.js
Expand Up @@ -109,10 +109,12 @@ 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.
* - `extensions` is reserved for adding non-standard properties.
*/
export type ExecutionResult = {|
errors?: $ReadOnlyArray<GraphQLError>,
data?: ObjMap<mixed> | null,
extensions?: ObjMap<mixed>,
|};

export type ExecutionArgs = {|
Expand Down