UNPKG

@daysnap/horn-ui

Version:

hron ui

46 lines (35 loc) 1.01 kB
import type { PropType } from 'vue' export const numericProp = [Number, String] export const basicProp = [Number, String, Boolean] export const makeAnyProp = (defaultVal: any) => ({ type: null, default: defaultVal, }) export const makeArrayProp = <T>(defaultVal: T[] = []) => ({ type: Array as PropType<T[]>, default: () => defaultVal, }) export const makeNumericProp = <T>(defaultVal: T) => ({ type: numericProp, default: defaultVal, }) export const makeBasicProp = <T>(defaultVal: T) => ({ type: basicProp, default: defaultVal, }) export const makeNumberProp = <T>(defaultVal: T) => ({ type: Number, default: defaultVal, }) export const makeStringProp = <T>(defaultVal: T) => ({ type: String as unknown as PropType<T>, default: defaultVal, }) export const makeBooleanProp = (defaultVal: boolean) => ({ type: Boolean, default: defaultVal, }) export const makeUnionTypesProp = <T>(defaultVal: T) => ({ type: [Boolean, Array] as any as PropType<T>, default: defaultVal, })