Skip to content

Commit

Permalink
style: readonly graphql errors
Browse files Browse the repository at this point in the history
  • Loading branch information
enisdenjo committed Nov 3, 2020
1 parent fa3cc58 commit 5894eb6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,8 @@ export function createServer(
if (areGraphQLErrors(maybeExecArgsOrErrors)) {
return await emit.error(maybeExecArgsOrErrors);
}
execArgs = maybeExecArgsOrErrors as ExecutionArgs; // because not graphql errors
// not errors, is exec args
execArgs = maybeExecArgsOrErrors;
} else {
if (!schema) {
// you either provide a schema dynamically through
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function isAsyncIterable<T = unknown>(
return typeof Object(val)[Symbol.asyncIterator] === 'function';
}

export function areGraphQLErrors(obj: unknown): obj is GraphQLError[] {
export function areGraphQLErrors(obj: unknown): obj is readonly GraphQLError[] {
return (
Array.isArray(obj) &&
// must be at least one error
Expand Down

0 comments on commit 5894eb6

Please sign in to comment.