UNPKG

funval

Version:

A minimalist library for data validation using functions interfaces.

14 lines (13 loc) 545 B
import { ObjectProperty } from './utils'; export declare type ErrorLike = string | Error; export declare type Path = ObjectProperty[]; export interface ErrorPath { path: ObjectProperty[]; error: Error; } export default interface ValidationError extends Error { paths?: ErrorPath[]; } export declare function getErrorPaths(error: ValidationError, path: Path): ErrorPath[]; export declare function toError(error: ErrorLike): Error; export declare function createValidationError(paths: ErrorPath[], error?: ErrorLike): ValidationError;