Skip to content

Commit

Permalink
fix: Minimum GraphQL v16 support (#1017)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgriesser committed Nov 18, 2021
1 parent c0e55b5 commit 9ec3442
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ export class SchemaBuilder {
name: 'Query',
fields: {
ok: {
type: GraphQLNonNull(GraphQLBoolean),
type: new GraphQLNonNull(GraphQLBoolean),
resolve: () => true,
},
},
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/wrapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,10 @@ export function rewrapAsGraphQLType(baseType: GraphQLNamedType, wrapping: NexusF
let finalType: GraphQLType = baseType
wrapping.forEach((wrap) => {
if (wrap === 'List') {
finalType = GraphQLList(finalType)
finalType = new GraphQLList(finalType)
} else if (wrap === 'NonNull') {
if (!isNonNullType(finalType)) {
finalType = GraphQLNonNull(finalType)
finalType = new GraphQLNonNull(finalType)
}
} else {
throw new Unreachable(wrap)
Expand Down
2 changes: 1 addition & 1 deletion tests/plugins/nullabilityGuardPlugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const types = [
description: 'Showing that the defaults works for all resolvers, not just Nexus ones',
fields: () => ({
id: {
type: GraphQLNonNull(GraphQLID),
type: new GraphQLNonNull(GraphQLID),
},
}),
}),
Expand Down
2 changes: 1 addition & 1 deletion tests/wrapping.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('wrapping', () => {
})

it('should wrap if the type is a GraphQL type', () => {
const x = normalizeArgWrapping(nonNull(list(GraphQLList(GraphQLString))))
const x = normalizeArgWrapping(nonNull(list(new GraphQLList(GraphQLString))))
expect(x).toBeInstanceOf(NexusArgDef)
})
})
Expand Down

0 comments on commit 9ec3442

Please sign in to comment.