Results
Functions in this package that can fail return a Result. They never throw on bad input.
type Result<T, E> = { readonly ok: true; readonly value: T } | { readonly ok: false; readonly error: E };ok(value) builds the success case and err(error) builds the failure case. Check result.ok to narrow the type, then read value or error.
Parsing errors are a ParseError, a record of a path to the bad value and a reason string from the closed ParseReason union. A caller can switch on reason, and TypeScript checks that every case is handled. See Parsing.