Skip to content

Commit

Permalink
fix: update remaining GraphQLNonNull<GraphQLType> codepoints to
Browse files Browse the repository at this point in the history
`GraphQLNonNull<GraphQLNullableType>`

This is related to graphql#3597, in the sense that graphql#3597 made the
`GraphQLNonNull<GraphQL*Type>` => `GraphQLNonNull<GraphQLNullable*Type>`
change in other code points related to the `isNonNullType` function, but
not within `GraphQLWrappingType` or assertNonNullType.

This PR was prompted by the uncovering of a bug by a different PR, see:
graphql#3617 (comment)
  • Loading branch information
yaacovCR committed Jun 2, 2022
1 parent 540bb38 commit ab5a471
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/type/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ export function isNonNullType(
return instanceOf(type, GraphQLNonNull);
}

export function assertNonNullType(type: unknown): GraphQLNonNull<GraphQLType> {
export function assertNonNullType(
type: unknown,
): GraphQLNonNull<GraphQLNullableType> {
if (!isNonNullType(type)) {
throw new Error(`Expected ${inspect(type)} to be a GraphQL Non-Null type.`);
}
Expand Down Expand Up @@ -395,7 +397,7 @@ export class GraphQLNonNull<T extends GraphQLNullableType> {

export type GraphQLWrappingType =
| GraphQLList<GraphQLType>
| GraphQLNonNull<GraphQLType>;
| GraphQLNonNull<GraphQLNullableType>;

export function isWrappingType(type: unknown): type is GraphQLWrappingType {
return isListType(type) || isNonNullType(type);
Expand Down

0 comments on commit ab5a471

Please sign in to comment.