Delta-Pack - v0.2.9
    Preparing search index...

    Function OptionalType

    • 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.

      Type Parameters

      • const V extends ValueType

        The underlying type when present

      Parameters

      • value: V

        The type of the value when present

      Returns UnifiedType<{ type: "optional"; value: V }>

      const User = ObjectType("User", {
      name: StringType(),
      nickname: OptionalType(StringType()), // May be undefined
      avatar: OptionalType(ReferenceType(Image)),
      });