@metreeca/core - v0.9.22
    Preparing search index...

    Type Alias Trace

    Trace: ReadonlyArray<string | { readonly [key: string]: Trace }>

    Validation trace.

    Lists every violation incurred at a position, so a value breaking several constraints is diagnosed in full in one read rather than one error per run. Each item takes either of two forms:

    • a message — an atomic violation, as self-contained human-readable text; the validators of this module prefix theirs with the constraint facet incurring it, in braces ("{integer} expected integral value");
    • a record — sub-traces grouped by key, nesting to mirror the shape of the value and bottoming out in messages; a key reporting no violation is dropped rather than mapped to an empty trace.

    The keyed form addresses the parts of a compound value: array keys element violations by decimal position ("2"), object and entry key them by property name ("label"), so a report is navigated the way the value it describes is. Key a trace of your own by any convention that navigates the value as usefully.

    A trace handed back by this module always carries a violation, at every level: an empty list, an empty record, and a branch left empty are all reported as undefined instead.