PromucFlow_constructor/app/client/src/constants/WidgetValidation.ts

20 lines
484 B
TypeScript
Raw Normal View History

2019-11-22 13:12:39 +00:00
// Always add a validator function in ./Validators for these types
2019-11-19 12:44:58 +00:00
export const VALIDATION_TYPES = {
TEXT: "TEXT",
NUMBER: "NUMBER",
BOOLEAN: "BOOLEAN",
OBJECT: "OBJECT",
2019-11-22 13:12:39 +00:00
ARRAY: "ARRAY",
2019-11-19 12:44:58 +00:00
TABLE_DATA: "TABLE_DATA",
2019-11-22 13:12:39 +00:00
DATE: "DATE",
};
export type ValidationResponse = {
isValid: boolean;
parsed: any;
2019-12-10 13:30:16 +00:00
message?: string;
2019-11-19 12:44:58 +00:00
};
export type ValidationType = typeof VALIDATION_TYPES[keyof typeof VALIDATION_TYPES];
2019-11-22 13:12:39 +00:00
export type Validator = (value: any) => ValidationResponse;