chore: add types

This commit is contained in:
aalizzwell 2022-10-03 13:39:44 +08:00
parent ab7a53d9d8
commit cd339fd254
1 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,21 @@
/**
*
*/
export enum ViewType {
Text = 'text',
Tag = 'tag'
};
/**
*
* @param defaultValue
* @param enumType
* @returns
*/
export function enumTypeProp<T extends string | number>(defaultValue: T, enumType: Record<string | number, any>) {
return {
default: defaultValue,
validator(value: T) {
return enumType[value] !== undefined
}
}
}