UNPKG

@backland/schema

Version:

TypeScript schema declaration and validation library with static type inference

18 lines (17 loc) 765 B
export type ValidationCustomMessage = string | ((value: any, originalError: Error) => string | Error); export type FieldParserOptionsObject = { allowExtraFields?: boolean; customErrorMessage?: ValidationCustomMessage; customMessage?: ValidationCustomMessage; excludeInvalidListItems?: boolean; includeHidden?: boolean; partial?: boolean; exclude?: string[]; }; export type FieldParserConfig = ValidationCustomMessage | FieldParserOptionsObject; export type FieldTypeParser<Type> = (input: any, config?: FieldParserConfig) => Type; export declare function parseValidationError(input: any, customMessage: ValidationCustomMessage | undefined, originalError: (Error & { [K: string]: any; }) | string): Error & { [K: string]: any; };