Kit
Type aliases

ArrayLikeCodecSize

ArrayLikeCodecSize<TPrefix> = TPrefix | number | "remainder"

Defines the possible size strategies for array-like codecs (array, map, and set).

The size of the collection can be determined using one of the following approaches:

  • A NumberCodec, NumberDecoder, or NumberEncoder to store a size prefix.
  • A fixed number of items, enforcing an exact length.
  • The string "remainder", which infers the number of items by consuming the rest of the available bytes. This option is only available when encoding fixed-size items.

Type Parameters

Type ParameterDescription
TPrefix extends NumberCodec | NumberDecoder | NumberEncoderA number codec, decoder, or encoder used for size prefixing.

On this page