From e65b5a7952d6ed0e94255cd1b9e19b70ab71d779 Mon Sep 17 00:00:00 2001 From: Tim Griesser Date: Thu, 2 Sep 2021 19:44:37 -0400 Subject: [PATCH] refactor: remove duplicate core schema type checks (#978) --- src/builder.ts | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/builder.ts b/src/builder.ts index 56e64ce6..f7f60138 100644 --- a/src/builder.ts +++ b/src/builder.ts @@ -1716,7 +1716,6 @@ export function makeSchemaInternal(config: SchemaConfig) { builder.addTypes(config.schemaRoots) } const { finalConfig, typeMap, missingTypes, schemaExtension, onAfterBuildFns } = builder.getFinalTypeMap() - const { Query, Mutation, Subscription } = typeMap function getRootType(rootType: 'query' | 'mutation' | 'subscription', defaultType: string) { const rootTypeVal = config.schemaRoots?.[rootType] ?? defaultType @@ -1736,19 +1735,6 @@ export function makeSchemaInternal(config: SchemaConfig) { return returnVal } - /* istanbul ignore next */ - if (!isObjectType(Query)) { - throw new Error(`Expected Query to be a objectType, saw ${Query.constructor.name}`) - } - /* istanbul ignore next */ - if (Mutation && !isObjectType(Mutation)) { - throw new Error(`Expected Mutation to be a objectType, saw ${Mutation.constructor.name}`) - } - /* istanbul ignore next */ - if (Subscription && !isObjectType(Subscription)) { - throw new Error(`Expected Subscription to be a objectType, saw ${Subscription.constructor.name}`) - } - const schema = new GraphQLSchema({ query: getRootType('query', 'Query'), mutation: getRootType('mutation', 'Mutation'),