diff --git a/src/execution/execute.d.ts b/src/execution/execute.d.ts index f927d9082d..4b16654cbd 100644 --- a/src/execution/execute.d.ts +++ b/src/execution/execute.d.ts @@ -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 { +export interface ExecutionResult< + TData = { [key: string]: any }, + TExtensions = { [key: string]: any } +> { errors?: ReadonlyArray; // TS_SPECIFIC: TData. Motivation: https://github.com/graphql/graphql-js/pull/2490#issuecomment-639154229 data?: TData | null; + extensions?: TExtensions; } export interface ExecutionArgs { diff --git a/src/execution/execute.js b/src/execution/execute.js index 821b6e403f..7cd8a6aeee 100644 --- a/src/execution/execute.js +++ b/src/execution/execute.js @@ -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, data?: ObjMap | null, + extensions?: ObjMap, |}; export type ExecutionArgs = {|