rsuite
Version:
A suite of react components
18 lines (14 loc) • 508 B
TypeScript
interface CheckResult<T = string> {
hasError: boolean;
errorMessage: T;
}
declare class Type<ValueType = any, ErrorMsgType = string, DataType = any> {
constructor(name: string | number | symbol);
check: (value: ValueType, data: DataType) => CheckResult<ErrorMsgType>;
addRule: (
onValid: (value: ValueType, data: DataType) => CheckResult<ErrorMsgType> | boolean,
errorMessage: ErrorMsgType
) => this;
isRequired: (errorMessage: ErrorMsgType) => this;
}
export { CheckResult, Type };