Create an optional (nullable) type.
Optional values are encoded with a presence bit. When absent, no additional data is encoded. Use for fields that may be undefined.
The underlying type when present
The type of the value when present
const User = ObjectType("User", { name: StringType(), nickname: OptionalType(StringType()), // May be undefined avatar: OptionalType(ReferenceType(Image)),}); Copy
const User = ObjectType("User", { name: StringType(), nickname: OptionalType(StringType()), // May be undefined avatar: OptionalType(ReferenceType(Image)),});
Create an optional (nullable) type.
Optional values are encoded with a presence bit. When absent, no additional data is encoded. Use for fields that may be undefined.