diff --git a/src/execution/execute.js b/src/execution/execute.js index 679fa27cba..79a3b77062 100644 --- a/src/execution/execute.js +++ b/src/execution/execute.js @@ -324,16 +324,13 @@ export function buildExecutionContext( return coercedVariableValues.errors; } - const variableValues = coercedVariableValues.coerced; - invariant(variableValues, 'Has variables if no errors.'); - return { schema, fragments, rootValue, contextValue, operation, - variableValues, + variableValues: coercedVariableValues.coerced, fieldResolver: fieldResolver || defaultFieldResolver, typeResolver: typeResolver || defaultTypeResolver, errors: [], diff --git a/src/execution/values.js b/src/execution/values.js index e12b828b8d..d4dd60e9e5 100644 --- a/src/execution/values.js +++ b/src/execution/values.js @@ -28,10 +28,9 @@ import { coerceValue } from '../utilities/coerceValue'; import { typeFromAST } from '../utilities/typeFromAST'; import { valueFromAST } from '../utilities/valueFromAST'; -type CoercedVariableValues = {| - errors: $ReadOnlyArray | void, - coerced: { [variable: string]: mixed, ... } | void, -|}; +type CoercedVariableValues = + | {| errors: $ReadOnlyArray |} + | {| coerced: { [variable: string]: mixed, ... } |}; /** * Prepares an object map of variableValues of the correct type based on the @@ -108,9 +107,7 @@ export function getVariableValues( coercedValues[varName] = coerced.value; } - return errors.length === 0 - ? { errors: undefined, coerced: coercedValues } - : { errors, coerced: undefined }; + return errors.length === 0 ? { coerced: coercedValues } : { errors }; } /**