@mmstack/form-validation
Version:
Provides a type-safe, composable, and localizable validation system designed specifically for use with [@mmstack/form-core](https://www.npmjs.com/package/@mmstack/form-core). It enables defining validation rules clearly within your TypeScript code and int
18 lines (17 loc) • 585 B
TypeScript
import { Validator } from './validator.type';
export declare function defaultMergeMessage(errors: string[]): {
error: string;
tooltip: string;
};
export declare function mergeValidators<T>(...validators: Validator<T>[]): (value: T) => string[];
type MergeFn<T> = ((value: T) => string) & {
resolve: (mergedError: string) => {
error: string;
tooltip: string;
};
};
export declare function createMergeValidators(merge?: (errors: string[]) => string | {
tooltip: string;
error: string;
}): <T>(validators: Validator<T>[]) => MergeFn<T>;
export {};