toMapDataParser
The toMapDataParser() function converts a Clean handler (NewType, constraint, primitive, or entity property definition) into a DataParser. The resulting parser maps parsed input into a typed object while preserving business kinds (newTypeKind, constrainedTypeKind) when available.
Interactive example
Syntax
Classic signature
typescript
function toMapDataParser(
input: ConstraintHandler | ConstraintsSetHandler | PrimitiveHandler | EntityPropertyDefinition,
params?: { coerce?: boolean }
): DDataParser.Contract<MappedValue, unknown>Parameters
input: Clean handler to convert (NewType, constraint, constraints set, primitive, or entity property definition).params: Conversion options.params.coerce: Enables coercion on compatible parsers (string, number, boolean, date, time, etc.).
Return value
A DDataParser.Contract that:
- parses
unknowninput, - maps output into a typed object ready for domain usage,
- preserves business type markers when present.
