Skip to main content

GraphQLNonNull <T>

Non-Null Type Wrapper

A non-null is a wrapping type which points to another type. Non-null types enforce that their values are never null and can ensure an error is raised if this ever occurs during a request. It is useful for fields which you can make a strong guarantee on non-nullability, for example usually the id field of a database row will never be null.

Example:

const RowType = new GraphQLObjectType({
name: 'Row',
fields: () => ({
id: { type: new GraphQLNonNull(GraphQLString) },
})
})

Note: the enforcement of non-nullability occurs within the executor.

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

Properties

readonlyofType

ofType: T

Accessors

[toStringTag]

  • get [toStringTag](): string
  • Returns string

Methods

toJSON

  • toJSON(): string
  • Returns string

toString

  • toString(): string
  • Returns string