Interface ActionCallArgumentSerializer<TOriginal, TSerialized>

Serializer of action call arguments.

interface ActionCallArgumentSerializer<TOriginal, TSerialized> {
    id: string;
    deserialize(
        value: TSerialized,
        deserializeChild: (v: unknown) => unknown,
        targetRoot: undefined | object,
    ): TOriginal;
    serialize(
        value: unknown,
        serializeChild: (v: unknown) => unknown,
        targetRoot: undefined | object,
    ): typeof cannotSerialize | TSerialized;
}

Type Parameters

  • TOriginal
  • TSerialized

Properties

Methods

Properties

id: string

Serializer ID, must be unique.

Methods

  • Deserializes an action call argument.

    Parameters

    • value: TSerialized

      Value to deserialize.

    • deserializeChild: (v: unknown) => unknown

      Deserialize a child.

    • targetRoot: undefined | object

      Target root, if provided.

    Returns TOriginal

  • Serializes an action call argument, returning cannotSerialize if not possible.

    Parameters

    • value: unknown

      Value to serialize.

    • serializeChild: (v: unknown) => unknown

      Serialize a child.

    • targetRoot: undefined | object

      Target root, if provided.

    Returns typeof cannotSerialize | TSerialized