@cowwoc/requirements
Version:
A fluent API for enforcing design contracts with automatic message generation.
30 lines (29 loc) • 855 B
text/typescript
/**
* A failed validation.
*/
interface ValidationFailure {
/**
* Returns the message corresponding to the validation failure.
*
* @returns the message corresponding to the validation failure
*/
getMessage(): string;
/**
* Returns the type of error that is associated with this failure.
*
* @returns the type of error that is associated with this failure
*/
getType(): string;
/**
* Returns the error corresponding to the validation failure.
*
* @returns the error corresponding to the validation failure
*/
getError(): Error;
}
/**
* @param value - a value
* @returns true if the value is an instance of `ValidationFailure`
*/
declare function isValidationFailure(value: unknown): value is ValidationFailure;
export { type ValidationFailure, isValidationFailure };