Skip to content

Commit 92f20dc

Browse files
authored
chore: add test confirming v16 schema compat (#1054)
1 parent bbc969a commit 92f20dc

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

src/definitions/_types.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@ export type NexusGraphQLInterfaceTypeConfig = WithExt<
156156
> & { interfaces: () => GraphQLInterfaceType[] }
157157

158158
export interface NexusGraphQLSchema extends GraphQLSchema {
159-
extensions: { nexus: NexusSchemaExtension }
159+
extensions: {
160+
nexus: NexusSchemaExtension
161+
[attributeName: string]: unknown
162+
}
160163
}
161164

162165
export type NexusFeaturesInput = {

tests/makeSchema.spec.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { printSchema } from 'graphql'
1+
import { GraphQLSchema, printSchema } from 'graphql'
22
import os from 'os'
33
import path from 'path'
44
import { objectType } from '../src'
@@ -151,4 +151,16 @@ describe('makeSchema', () => {
151151
expect(tsTypes).toContain(`import type { Context } from "./makeSchema.spec"`)
152152
})
153153
})
154+
155+
it('is compatible with GraphQL schema types', () => {
156+
const someFn = (schema: GraphQLSchema) => {
157+
return schema.toConfig()
158+
}
159+
160+
const nexusSchema = makeSchema({
161+
types: [],
162+
})
163+
164+
someFn(nexusSchema)
165+
})
154166
})

tests/typegenPrinterGlobals.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('typegenPrinter: globals', () => {
1919
schema: path.join(__dirname, 'typegen-globals/schema.gen.graphql'),
2020
} as const
2121

22-
const schema = (await generateSchema({
22+
const schema = await generateSchema({
2323
outputs,
2424
shouldGenerateArtifacts: true,
2525
types: [buildSchema(EXAMPLE_SDL)],
@@ -35,7 +35,7 @@ describe('typegenPrinter: globals', () => {
3535

3636
return content.replace("'nexus'", `'../../src'`)
3737
},
38-
})) as core.NexusGraphQLSchema
38+
})
3939

4040
metadata = new TypegenMetadata({
4141
outputs,

0 commit comments

Comments
 (0)