DependentStructDecoderFieldFactory
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 Parameter | Description |
|---|---|
TPriorFields extends Record<string, unknown> | The shape of the fields that have already been decoded by the time this factory is invoked. |
TValue | The type of the value produced by the returned decoder. |
Parameters
| Parameter | Type |
|---|---|
fields | Readonly<TPriorFields> |
Returns
Decoder<TValue>