optional
Allows undefined while keeping a strict parser for the present value. DDataParser.optional(inner) returns the output of inner when a value is provided and lets undefined pass otherwise.
Interactive example
Parameters
inner: parser applied when a value is provided.coalescingValue: (optional) replacesundefinedwith a default value and narrows the output type toOutput<inner>.checkers:checkerRefineor custom helpers evaluatingOutput<inner> | undefined.errorMessage: message used when the input is neitherundefinednor valid forinner.
Return value
A DataParserOptional. schema.parse(data) returns DEither.success<Output | undefined> or DEither.error<DataParserError> with the incriminated path. Checkers/restrictions apply only when the value is not undefined (unless you implement different logic in your refinements).
