UNPKG

self-assert

Version:

A small TypeScript library for designing models with built-in validity.

31 lines 1.03 kB
import type { RuleLabelAsJson } from "./RuleLabel"; import type { LabelId, LabeledRule } from "./types"; /** * JSON representation of {@link RulesBroken} * * @category Supporting types */ export interface RulesBrokenAsJson { brokenRules: RuleLabelAsJson[]; } /** * Provides a way to handle multiple failed rules, * by their labels. * * @see {@link RuleLabel} * @category Rules */ export declare class RulesBroken extends Error { protected brokenRules: LabeledRule[]; /** @category Creation */ static fromJson(rulesBrokenAsJson: RulesBrokenAsJson): RulesBroken; /** @category Creation */ constructor(brokenRules: LabeledRule[]); /** @category Inspection */ hasRuleBrokenWith(labelId: LabelId, labelDescription: string): boolean; /** @category Inspection */ hasOnlyOneRuleBrokenWith(labelId: LabelId, labelDescription: string): boolean; /** @category Inspection */ forEachRuleBroken(closure: (brokenRule: LabeledRule) => void): void; } //# sourceMappingURL=RulesBroken.d.ts.map