tynder
Version:
TypeScript friendly Data validator for JavaScript.
18 lines (17 loc) • 992 B
TypeScript
import { ErrorTypes, ErrorMessages, TypeAssertion, RepeatedAssertion, SpreadAssertion, OptionalAssertion, ValidationContext } from '../types';
export declare const errorTypeNames: string[];
export declare const defaultMessages: ErrorMessages;
declare type TopRepeatable = RepeatedAssertion | SpreadAssertion | OptionalAssertion | null;
interface ReportErrorArguments {
ctx: ValidationContext;
substitutions?: [[string, string]];
}
export declare function formatErrorMessage(msg: string, data: any, ty: TypeAssertion, args: ReportErrorArguments, values: {
dataPath: string;
topRepeatable: TopRepeatable;
parentType: string;
entryName: string;
}): string;
export declare function reportError(errType: ErrorTypes, data: any, ty: TypeAssertion, args: ReportErrorArguments): void;
export declare function reportErrorWithPush(errType: ErrorTypes, data: any, tyidx: [TypeAssertion, number | string | undefined], args: ReportErrorArguments): void;
export {};