From 719ef940bd868ab0b073c87435d2cb677f4b6824 Mon Sep 17 00:00:00 2001 From: Yaacov Rydzinski Date: Sun, 5 Dec 2021 02:00:00 -0500 Subject: [PATCH] move guard to appropriate location (#103) guard only necessary for those using graphql-execute as drop-in replacement for graphql@15 --- src/execution/execute.ts | 7 +++++++ src/execution/executor.ts | 6 ------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/execution/execute.ts b/src/execution/execute.ts index cb3ec7edb3..e57b8fda78 100644 --- a/src/execution/execute.ts +++ b/src/execution/execute.ts @@ -1,6 +1,7 @@ import type { PromiseOrValue } from '../jsutils/PromiseOrValue'; import { isPromise } from '../jsutils/isPromise'; import { isAsyncIterable } from '../jsutils/isAsyncIterable'; +import { devAssert } from '../jsutils/devAssert'; import type { ExecutionArgs, @@ -24,6 +25,12 @@ export function execute( ): PromiseOrValue< ExecutionResult | AsyncGenerator > { + // Temporary for v15 to v16 migration. Remove in v17 + devAssert( + arguments.length < 2, + 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.', + ); + const executor = new Executor(); return executor.execute(args); } diff --git a/src/execution/executor.ts b/src/execution/executor.ts index 2e22f0fe0f..8e80b5d9e1 100644 --- a/src/execution/executor.ts +++ b/src/execution/executor.ts @@ -257,12 +257,6 @@ export class Executor { ): PromiseOrValue< ExecutionResult | AsyncGenerator > { - // Temporary for v15 to v16 migration. Remove in v17 - devAssert( - arguments.length < 2, - 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.', - ); - const exeContext = this.buildExecutionContext(args); // If a valid execution context cannot be created due to incorrect arguments,