tuple
DDataParser.tuple() describes a positional array with different parsers per index and, optionally, a rest. Perfect to model multi-value returns or fixed parameters.
Interactive example
Parameters
shape: array of parsers[DP.string(), DP.number(), ...].rest: optional parser applied to extra elements.checkers:checkerArrayMin,checkerArrayMax,checkerRefineto validate the overall shape.
Return value
A DataParserTuple. schema.parse(data) returns DEither.success<Output> if all elements satisfy their parser, otherwise DEither.error<DataParserError> with the incriminated index. Tuple-level array min/max checkers are reflected in the output type in the same way as array parsers.
Other examples
Custom checkers
Extended mode
See also
templateLiteral- Parser for formatted stringsnil- Parser for null/undefined values
