PromucFlow_constructor/app/client/src/constants/WidgetValidation.ts
2019-11-22 14:02:55 +00:00

19 lines
464 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;
};
export type ValidationType = typeof VALIDATION_TYPES[keyof typeof VALIDATION_TYPES];
export type Validator = (value: any) => ValidationResponse;