File tree Expand file tree Collapse file tree 6 files changed +31
-2
lines changed
Expand file tree Collapse file tree 6 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { PromiseOrValue } from '../jsutils/PromiseOrValue';
44import { Path } from '../jsutils/Path' ;
55
66import { GraphQLError } from '../error/GraphQLError' ;
7+ import { GraphQLFormattedError } from '../error/formatError' ;
78
89import {
910 DocumentNode ,
@@ -55,6 +56,16 @@ export interface ExecutionResult<
5556 extensions ?: TExtensions ;
5657}
5758
59+ export interface FormattedExecutionResult <
60+ TData = { [ key : string ] : any } ,
61+ TExtensions = { [ key : string ] : any }
62+ > {
63+ errors ?: ReadonlyArray < GraphQLFormattedError > ;
64+ // TS_SPECIFIC: TData. Motivation: https://github.com/graphql/graphql-js/pull/2490#issuecomment-639154229
65+ data ?: TData | null ;
66+ extensions ?: TExtensions ;
67+ }
68+
5869export interface ExecutionArgs {
5970 schema : GraphQLSchema ;
6071 document : DocumentNode ;
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import promiseReduce from '../jsutils/promiseReduce';
1616import promiseForObject from '../jsutils/promiseForObject' ;
1717import { addPath , pathToArray } from '../jsutils/Path' ;
1818
19+ import type { GraphQLFormattedError } from '../error/formatError' ;
1920import { GraphQLError } from '../error/GraphQLError' ;
2021import { locatedError } from '../error/locatedError' ;
2122
@@ -120,6 +121,12 @@ export type ExecutionResult = {|
120121 extensions ?: ObjMap < mixed > ,
121122| } ;
122123
124+ export type FormattedExecutionResult = { |
125+ errors ?: $ReadOnlyArray < GraphQLFormattedError > ,
126+ data ?: ObjMap < mixed > | null ,
127+ extensions ?: ObjMap < mixed > ,
128+ | } ;
129+
123130export type ExecutionArgs = { |
124131 schema : GraphQLSchema ,
125132 document : DocumentNode ,
Original file line number Diff line number Diff line change 77 defaultTypeResolver ,
88 ExecutionArgs ,
99 ExecutionResult ,
10+ FormattedExecutionResult ,
1011} from './execute' ;
1112
1213export { getDirectiveValues } from './values' ;
Original file line number Diff line number Diff line change @@ -8,6 +8,11 @@ export {
88 defaultFieldResolver ,
99 defaultTypeResolver ,
1010} from './execute' ;
11- export type { ExecutionArgs , ExecutionResult } from './execute' ;
11+
12+ export type {
13+ ExecutionArgs ,
14+ ExecutionResult ,
15+ FormattedExecutionResult ,
16+ } from './execute' ;
1217
1318export { getDirectiveValues } from './values' ;
Original file line number Diff line number Diff line change @@ -299,6 +299,7 @@ export {
299299 getDirectiveValues ,
300300 ExecutionArgs ,
301301 ExecutionResult ,
302+ FormattedExecutionResult ,
302303} from './execution/index' ;
303304
304305export {
Original file line number Diff line number Diff line change @@ -288,7 +288,11 @@ export {
288288 getDirectiveValues ,
289289} from './execution/index' ;
290290
291- export type { ExecutionArgs , ExecutionResult } from './execution/index' ;
291+ export type {
292+ ExecutionArgs ,
293+ ExecutionResult ,
294+ FormattedExecutionResult ,
295+ } from './execution/index' ;
292296
293297export { subscribe , createSourceEventStream } from './subscription/index' ;
294298export type { SubscriptionArgs } from './subscription/index' ;
You can’t perform that action at this time.
0 commit comments