PromucFlow_constructor/app/client/src/constants/WidgetValidation.ts
2019-12-10 13:30:16 +00:00

20 lines
484 B
TypeScript

// Always add a validator function in ./Validators for these types
export const VALIDATION_TYPES = {
TEXT: "TEXT",
NUMBER: "NUMBER",
BOOLEAN: "BOOLEAN",
OBJECT: "OBJECT",
ARRAY: "ARRAY",
TABLE_DATA: "TABLE_DATA",
DATE: "DATE",
};
export type ValidationResponse = {
isValid: boolean;
parsed: any;
message?: string;
};
export type ValidationType = typeof VALIDATION_TYPES[keyof typeof VALIDATION_TYPES];
export type Validator = (value: any) => ValidationResponse;