Type Alias ISerializer<TSerializedValue>

ISerializer: { serialize<TValue>(value: TValue): TSerializedValue }

Serializer contract for converting values to a serialized representation. Transforms runtime objects into a serializable format (usually JSON-compatible).

Difference from ICodec (Encoder):

  • Serializer: Works with arbitrary plain data (no custom class instances)
  • Encoder: Can be specialized for specific types

Common use cases:

  • Convert domain objects to JSON for API responses
  • Transform data structures for storage/caching
  • Prepare data for transmission over the network

Type Parameters

  • TSerializedValue = unknown

    The serialized output format (usually JSON-compatible, defaults to unknown)

    IMPORT_PATH: "@daiso-tech/core/serde/contracts"

Type declaration

  • serialize:function
    • Serializes the given value into a serialized representation. Converts runtime values to a format suitable for storage or transmission.

      Type Parameters

      • TValue

        The type of value being serialized

      Parameters

      • value: TValue

        The value to serialize (must be plain data, not custom class instances)

      Returns TSerializedValue

      The serialized representation of the value

      If serialization fails (circular references, unsupported types, etc.)