web-signature
Version:
Primitive and fast framework for rendering web interfaces
31 lines (30 loc) • 751 B
TypeScript
type TypesMap = {
string: string;
number: number;
boolean: boolean;
array: any[];
null: null;
};
interface Prop {
/**
* The type of the property.
*/
type: keyof TypesMap;
/**
* Checks the validity of the value and the specified type
* @param {string | number | boolean | null} value
* @return boolean
*/
isValid: (value: TypesMap[keyof TypesMap]) => boolean;
/**
* Indicates whether the property is required.
*/
required?: boolean;
/**
* A function to validate the value of the property.
* @param {string | number | boolean | null} value
* @return boolean
*/
validate?: (value: TypesMap[keyof TypesMap]) => boolean;
}
export default Prop;