Type Alias Codec<TFrom, TTo>

An object that can encode and decode a value to and from a Uint8Array. It supports encoding looser types than it decodes for convenience. For example, a bigint encoder will always decode to a bigint but can be used to encode a number.

Type Parameters

  • TFrom

    The type of the value to encode.

  • TTo extends TFrom = TFrom

    The type of the decoded value. Defaults to TFrom.