File tree 6 files changed +31
-2
lines changed
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';
4
4
import { Path } from '../jsutils/Path' ;
5
5
6
6
import { GraphQLError } from '../error/GraphQLError' ;
7
+ import { GraphQLFormattedError } from '../error/formatError' ;
7
8
8
9
import {
9
10
DocumentNode ,
@@ -55,6 +56,16 @@ export interface ExecutionResult<
55
56
extensions ?: TExtensions ;
56
57
}
57
58
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
+
58
69
export interface ExecutionArgs {
59
70
schema : GraphQLSchema ;
60
71
document : DocumentNode ;
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import promiseReduce from '../jsutils/promiseReduce';
16
16
import promiseForObject from '../jsutils/promiseForObject' ;
17
17
import { addPath , pathToArray } from '../jsutils/Path' ;
18
18
19
+ import type { GraphQLFormattedError } from '../error/formatError' ;
19
20
import { GraphQLError } from '../error/GraphQLError' ;
20
21
import { locatedError } from '../error/locatedError' ;
21
22
@@ -120,6 +121,12 @@ export type ExecutionResult = {|
120
121
extensions ?: ObjMap < mixed > ,
121
122
| } ;
122
123
124
+ export type FormattedExecutionResult = { |
125
+ errors ?: $ReadOnlyArray < GraphQLFormattedError > ,
126
+ data ?: ObjMap < mixed > | null ,
127
+ extensions ?: ObjMap < mixed > ,
128
+ | } ;
129
+
123
130
export type ExecutionArgs = { |
124
131
schema : GraphQLSchema ,
125
132
document : DocumentNode ,
Original file line number Diff line number Diff line change 7
7
defaultTypeResolver ,
8
8
ExecutionArgs ,
9
9
ExecutionResult ,
10
+ FormattedExecutionResult ,
10
11
} from './execute' ;
11
12
12
13
export { getDirectiveValues } from './values' ;
Original file line number Diff line number Diff line change @@ -8,6 +8,11 @@ export {
8
8
defaultFieldResolver ,
9
9
defaultTypeResolver ,
10
10
} from './execute' ;
11
- export type { ExecutionArgs , ExecutionResult } from './execute' ;
11
+
12
+ export type {
13
+ ExecutionArgs ,
14
+ ExecutionResult ,
15
+ FormattedExecutionResult ,
16
+ } from './execute' ;
12
17
13
18
export { getDirectiveValues } from './values' ;
Original file line number Diff line number Diff line change @@ -299,6 +299,7 @@ export {
299
299
getDirectiveValues ,
300
300
ExecutionArgs ,
301
301
ExecutionResult ,
302
+ FormattedExecutionResult ,
302
303
} from './execution/index' ;
303
304
304
305
export {
Original file line number Diff line number Diff line change @@ -288,7 +288,11 @@ export {
288
288
getDirectiveValues ,
289
289
} from './execution/index' ;
290
290
291
- export type { ExecutionArgs , ExecutionResult } from './execution/index' ;
291
+ export type {
292
+ ExecutionArgs ,
293
+ ExecutionResult ,
294
+ FormattedExecutionResult ,
295
+ } from './execution/index' ;
292
296
293
297
export { subscribe , createSourceEventStream } from './subscription/index' ;
294
298
export type { SubscriptionArgs } from './subscription/index' ;
You can’t perform that action at this time.
0 commit comments