Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/type/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import type {
GraphQLObjectType,
} from './definition';
import type {
OperationTypeNode,
SchemaDefinitionNode,
SchemaExtensionNode,
} from '../language/ast';
Expand Down Expand Up @@ -172,6 +173,17 @@ export class GraphQLSchema {
});
}

getOperationType(operation: OperationTypeNode): ?GraphQLObjectType {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you drop the ? here when you add a default case like this:

default:
  (operation: empty);
  invariant(false, 'Unexpected operation: `%s`', operation);

switch (operation) {
case 'query':
return this.getQueryType();
case 'mutation':
return this.getMutationType();
case 'subscription':
return this.getSubscriptionType();
}
}

getQueryType(): ?GraphQLObjectType {
return this._queryType;
}
Expand Down