diff --git a/packages/graphql-modules/src/module/resolvers.ts b/packages/graphql-modules/src/module/resolvers.ts index f74bebcc99..374a53a8ce 100644 --- a/packages/graphql-modules/src/module/resolvers.ts +++ b/packages/graphql-modules/src/module/resolvers.ts @@ -5,6 +5,7 @@ import { defaultFieldResolver, FieldNode, GraphQLResolveInfo, + isScalarType, } from 'graphql'; import { Resolvers, ModuleConfig } from './types'; import { ModuleMetadata } from './metadata'; @@ -508,7 +509,7 @@ function isResolveOptions(value: any): value is ResolveOptions { } function isScalarResolver(obj: any): obj is GraphQLScalarType { - return obj instanceof GraphQLScalarType; + return isScalarType(obj); } interface EnumResolver { diff --git a/packages/graphql-modules/src/shared/utils.ts b/packages/graphql-modules/src/shared/utils.ts index 3c63175788..20515269bd 100644 --- a/packages/graphql-modules/src/shared/utils.ts +++ b/packages/graphql-modules/src/shared/utils.ts @@ -1,4 +1,4 @@ -import { GraphQLSchema } from 'graphql'; +import { GraphQLSchema, isSchema } from 'graphql'; export function flatten(arr: T[]): T extends (infer A)[] ? A[] : T[] { return Array.prototype.concat(...arr) as any; @@ -105,7 +105,7 @@ export function uniqueId(isNotUsed: (id: string) => boolean) { } export function isNotSchema(obj: any): obj is T { - return obj instanceof GraphQLSchema === false; + return !isSchema(obj); } export function merge(