stapp-validate
Version:
Form validation module for stapp - modular state manager
21 lines (20 loc) • 655 B
TypeScript
export declare type ValidationFlags = {
onInit?: boolean;
onChange?: boolean;
onRevalidate?: boolean;
};
export declare type ValidationRule<State> = (value: string | void, fieldName: string, state: State, flags: ValidationFlags) => any;
export declare type ValidationRules<State> = {
[K: string]: ValidationRule<State>;
};
export declare type ValidationState = {
validating: {
[K: string]: boolean;
};
};
export declare type ValidateConfig<State> = {
rules: ((state: State) => ValidationRules<State>) | ValidationRules<State>;
moduleName?: string;
validateOnInit?: boolean;
setTouchedOnSubmit?: boolean;
};