Skip to content

Commit

Permalink
ExecutionResult: add 'extensions' field
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Jun 11, 2020
1 parent 916e697 commit bb0ba5a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
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 extending result with non-standard properties.
*/
export type ExecutionResult = {|
errors?: $ReadOnlyArray<GraphQLError>,
data?: ObjMap<mixed> | null,
extensions?: ObjMap<mixed>,
|};

export type ExecutionArgs = {|
Expand Down

0 comments on commit bb0ba5a

Please sign in to comment.