Skip to content

Commit 085c9ef

Browse files
Add devAssert about removal of positional arguments (#3365)
1 parent 30b4469 commit 085c9ef

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

src/execution/execute.ts

+6
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ export interface ExecutionArgs {
165165
* a GraphQLError will be thrown immediately explaining the invalid input.
166166
*/
167167
export function execute(args: ExecutionArgs): PromiseOrValue<ExecutionResult> {
168+
// Temporary for v15 to v16 migration. Remove in v17
169+
devAssert(
170+
arguments.length < 2,
171+
'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.',
172+
);
173+
168174
const { schema, document, variableValues, rootValue } = args;
169175

170176
// If arguments are missing or incorrect, throw an error.

src/execution/subscribe.ts

+7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { inspect } from '../jsutils/inspect';
2+
import { devAssert } from '../jsutils/devAssert';
23
import { isAsyncIterable } from '../jsutils/isAsyncIterable';
34
import { addPath, pathToArray } from '../jsutils/Path';
45
import type { Maybe } from '../jsutils/Maybe';
@@ -51,6 +52,12 @@ import { mapAsyncIterator } from './mapAsyncIterator';
5152
export async function subscribe(
5253
args: ExecutionArgs,
5354
): Promise<AsyncGenerator<ExecutionResult, void, void> | ExecutionResult> {
55+
// Temporary for v15 to v16 migration. Remove in v17
56+
devAssert(
57+
arguments.length < 2,
58+
'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.',
59+
);
60+
5461
const {
5562
schema,
5663
document,

src/graphql.ts

+7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { PromiseOrValue } from './jsutils/PromiseOrValue';
2+
import { devAssert } from './jsutils/devAssert';
23
import { isPromise } from './jsutils/isPromise';
34
import type { Maybe } from './jsutils/Maybe';
45

@@ -90,6 +91,12 @@ export function graphqlSync(args: GraphQLArgs): ExecutionResult {
9091
}
9192

9293
function graphqlImpl(args: GraphQLArgs): PromiseOrValue<ExecutionResult> {
94+
// Temporary for v15 to v16 migration. Remove in v17
95+
devAssert(
96+
arguments.length < 2,
97+
'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.',
98+
);
99+
93100
const {
94101
schema,
95102
source,

0 commit comments

Comments
 (0)