DependentStructDecoderFieldFactory

type DependentStructDecoderFieldFactory<TPriorFields, TValue> = (fields) => Decoder<TValue>;

A function that builds a Decoder for a struct field whose shape depends on the values of previously decoded fields in the same struct.

The function receives a frozen snapshot of all fields that have been decoded so far, in declaration order, and must return the Decoder that should be used to read the current field from the byte stream.

Type Parameters

Type ParameterDescription
TPriorFields extends Record<string, unknown>The shape of the fields that have already been decoded by the time this factory is invoked.
TValueThe type of the value produced by the returned decoder.

Parameters

ParameterType
fieldsReadonly<TPriorFields>

Returns

Decoder<TValue>

See

createDependentStructDecoder

On this page