File tree 6 files changed +26
-3
lines changed
6 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import promiseForObject from '../jsutils/promiseForObject';
16
16
import { type PromiseOrValue } from '../jsutils/PromiseOrValue' ;
17
17
import { type Path , 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
@@ -117,6 +118,12 @@ export type ExecutionResult = {
117
118
...
118
119
} ;
119
120
121
+ export type FormattedExecutionResult = { |
122
+ errors ?: $ReadOnlyArray < GraphQLFormattedError > ,
123
+ data ?: ObjMap < mixed > | null ,
124
+ extensions ?: ObjMap < mixed > ,
125
+ | } ;
126
+
120
127
export type ExecutionArgs = { |
121
128
schema : GraphQLSchema ,
122
129
document : DocumentNode ,
Original file line number Diff line number Diff line change 3
3
export { pathToArray as responsePathAsArray } from '../jsutils/Path' ;
4
4
5
5
export { execute , defaultFieldResolver , defaultTypeResolver } from './execute' ;
6
- export type { ExecutionArgs , ExecutionResult } from './execute' ;
6
+ export type {
7
+ ExecutionArgs ,
8
+ ExecutionResult ,
9
+ FormattedExecutionResult ,
10
+ } from './execute' ;
7
11
8
12
export { getDirectiveValues } from './values' ;
Original file line number Diff line number Diff line change @@ -288,7 +288,11 @@ export {
288
288
getDirectiveValues ,
289
289
} from './execution' ;
290
290
291
- export type { ExecutionArgs , ExecutionResult } from './execution' ;
291
+ export type {
292
+ ExecutionArgs ,
293
+ ExecutionResult ,
294
+ FormattedExecutionResult ,
295
+ } from './execution' ;
292
296
293
297
export { subscribe , createSourceEventStream } from './subscription' ;
294
298
export type { SubscriptionArgs } from './subscription' ;
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { PromiseOrValue } from '../jsutils/PromiseOrValue';
3
3
import { Path , addPath , pathToArray } from '../jsutils/Path' ;
4
4
5
5
import { GraphQLError } from '../error/GraphQLError' ;
6
- import { locatedError } from '../error/locatedError ' ;
6
+ import { GraphQLFormattedError } from '../error/formatError ' ;
7
7
8
8
import {
9
9
DirectiveNode ,
@@ -56,6 +56,12 @@ export interface ExecutionResult<TData = ExecutionResultDataDefault> {
56
56
data ?: TData | null ;
57
57
}
58
58
59
+ export interface FormattedExecutionResult < TData = ExecutionResultDataDefault > {
60
+ errors ?: ReadonlyArray < GraphQLFormattedError > ;
61
+ // TS_SPECIFIC: TData. Motivation: https://github.com/graphql/graphql-js/pull/2490#issuecomment-639154229
62
+ data ?: TData | null ;
63
+ }
64
+
59
65
export type ExecutionArgs = {
60
66
schema : GraphQLSchema ;
61
67
document : DocumentNode ;
Original file line number Diff line number Diff line change 6
6
defaultTypeResolver ,
7
7
ExecutionArgs ,
8
8
ExecutionResult ,
9
+ FormattedExecutionResult ,
9
10
} from './execute' ;
10
11
11
12
export { getDirectiveValues } from './values' ;
Original file line number Diff line number Diff line change @@ -287,6 +287,7 @@ export {
287
287
getDirectiveValues ,
288
288
ExecutionArgs ,
289
289
ExecutionResult ,
290
+ FormattedExecutionResult ,
290
291
} from './execution' ;
291
292
292
293
export {
You can’t perform that action at this time.
0 commit comments