File tree Expand file tree Collapse file tree 6 files changed +26
-3
lines changed Expand file tree Collapse file tree 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';
1616import { type PromiseOrValue } from '../jsutils/PromiseOrValue' ;
1717import { type Path , addPath , pathToArray } from '../jsutils/Path' ;
1818
19+ import { type GraphQLFormattedError } from '../error/formatError' ;
1920import { GraphQLError } from '../error/GraphQLError' ;
2021import { locatedError } from '../error/locatedError' ;
2122
@@ -117,6 +118,12 @@ export type ExecutionResult = {
117118 ...
118119} ;
119120
121+ export type FormattedExecutionResult = { |
122+ errors ?: $ReadOnlyArray < GraphQLFormattedError > ,
123+ data ?: ObjMap < mixed > | null ,
124+ extensions ?: ObjMap < mixed > ,
125+ | } ;
126+
120127export type ExecutionArgs = { |
121128 schema : GraphQLSchema ,
122129 document : DocumentNode ,
Original file line number Diff line number Diff line change 33export { pathToArray as responsePathAsArray } from '../jsutils/Path' ;
44
55export { execute , defaultFieldResolver , defaultTypeResolver } from './execute' ;
6- export type { ExecutionArgs , ExecutionResult } from './execute' ;
6+ export type {
7+ ExecutionArgs ,
8+ ExecutionResult ,
9+ FormattedExecutionResult ,
10+ } from './execute' ;
711
812export { getDirectiveValues } from './values' ;
Original file line number Diff line number Diff line change @@ -288,7 +288,11 @@ export {
288288 getDirectiveValues ,
289289} from './execution' ;
290290
291- export type { ExecutionArgs , ExecutionResult } from './execution' ;
291+ export type {
292+ ExecutionArgs ,
293+ ExecutionResult ,
294+ FormattedExecutionResult ,
295+ } from './execution' ;
292296
293297export { subscribe , createSourceEventStream } from './subscription' ;
294298export type { SubscriptionArgs } from './subscription' ;
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { PromiseOrValue } from '../jsutils/PromiseOrValue';
33import { Path , addPath , pathToArray } from '../jsutils/Path' ;
44
55import { GraphQLError } from '../error/GraphQLError' ;
6- import { locatedError } from '../error/locatedError ' ;
6+ import { GraphQLFormattedError } from '../error/formatError ' ;
77
88import {
99 DirectiveNode ,
@@ -56,6 +56,12 @@ export interface ExecutionResult<TData = ExecutionResultDataDefault> {
5656 data ?: TData | null ;
5757}
5858
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+
5965export type ExecutionArgs = {
6066 schema : GraphQLSchema ;
6167 document : DocumentNode ;
Original file line number Diff line number Diff line change 66 defaultTypeResolver ,
77 ExecutionArgs ,
88 ExecutionResult ,
9+ FormattedExecutionResult ,
910} from './execute' ;
1011
1112export { getDirectiveValues } from './values' ;
Original file line number Diff line number Diff line change @@ -287,6 +287,7 @@ export {
287287 getDirectiveValues ,
288288 ExecutionArgs ,
289289 ExecutionResult ,
290+ FormattedExecutionResult ,
290291} from './execution' ;
291292
292293export {
You can’t perform that action at this time.
0 commit comments