diff --git a/src/definitions/_types.ts b/src/definitions/_types.ts index d7480821..ac914b07 100644 --- a/src/definitions/_types.ts +++ b/src/definitions/_types.ts @@ -156,7 +156,10 @@ export type NexusGraphQLInterfaceTypeConfig = WithExt< > & { interfaces: () => GraphQLInterfaceType[] } export interface NexusGraphQLSchema extends GraphQLSchema { - extensions: { nexus: NexusSchemaExtension } + extensions: { + nexus: NexusSchemaExtension + [attributeName: string]: unknown + } } export type NexusFeaturesInput = { diff --git a/tests/makeSchema.spec.ts b/tests/makeSchema.spec.ts index 59de9750..5ed0b6e4 100644 --- a/tests/makeSchema.spec.ts +++ b/tests/makeSchema.spec.ts @@ -1,4 +1,4 @@ -import { printSchema } from 'graphql' +import { GraphQLSchema, printSchema } from 'graphql' import os from 'os' import path from 'path' import { objectType } from '../src' @@ -151,4 +151,16 @@ describe('makeSchema', () => { expect(tsTypes).toContain(`import type { Context } from "./makeSchema.spec"`) }) }) + + it('is compatible with GraphQL schema types', () => { + const someFn = (schema: GraphQLSchema) => { + return schema.toConfig() + } + + const nexusSchema = makeSchema({ + types: [], + }) + + someFn(nexusSchema) + }) }) diff --git a/tests/typegenPrinterGlobals.spec.ts b/tests/typegenPrinterGlobals.spec.ts index f86b7e94..5eb59037 100644 --- a/tests/typegenPrinterGlobals.spec.ts +++ b/tests/typegenPrinterGlobals.spec.ts @@ -19,7 +19,7 @@ describe('typegenPrinter: globals', () => { schema: path.join(__dirname, 'typegen-globals/schema.gen.graphql'), } as const - const schema = (await generateSchema({ + const schema = await generateSchema({ outputs, shouldGenerateArtifacts: true, types: [buildSchema(EXAMPLE_SDL)], @@ -35,7 +35,7 @@ describe('typegenPrinter: globals', () => { return content.replace("'nexus'", `'../../src'`) }, - })) as core.NexusGraphQLSchema + }) metadata = new TypegenMetadata({ outputs,