Handy in exhaustive switches (in default case) of enums values,
so that we have compilation-time exhaustive check (via never argument).
We return undefined instead of throwing error (e.g. via assertNever()) to support
unexpected values in case third party goes ahead in protocol implementation -- in this case we should ignore
respective part of protocol message based on undefined result of parsing.
Handy in exhaustive switches (in
default
case) of enums values, so that we have compilation-time exhaustive check (vianever
argument). We returnundefined
instead of throwing error (e.g. viaassertNever()
) to support unexpected values in case third party goes ahead in protocol implementation -- in this case we should ignore respective part of protocol message based onundefined
result of parsing.