FuncType - v1.4.1
    Preparing search index...

    Function toEnvelope

    • Serialize a value to a parsed JSON envelope (object/array/primitive) rather than a string. Use this when nesting functype values inside another structured serializer (SuperJSON / DBOS custom transformers / similar) whose custom-transformer hook expects JSON values, not strings — passing a string to such a hook causes the host to re-walk it character-by-character, destroying the round-trip.

      Equivalent to JSON.parse(serialize(value)) but exposed as a named entry point so consumers don't carry the parse/stringify shim.

      Returns JSONValue (tightened from unknown in 1.2.2) so consumers can drop the result straight into a host serializer's serialize hook without a boundary cast.

      Parameters

      • value: unknown

      Returns Serialization.JSONValue

      // Inside a DBOS custom serialization recipe — zero casts:
      DBOS.registerSerialization({
      name: "functype",
      isApplicable: Serialization.isFunctypeValue,
      serialize: Serialization.toEnvelope,
      deserialize: (o) => Serialization.fromEnvelope(o).orThrow(),
      })