import { PropType } from 'vue'; // eslint-disable-next-line @typescript-eslint/no-unused-vars type ExtractNonArray = T extends (infer U)[] ? never : T type Prop = ExtractNonArray> // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type type NativeType = string | boolean | number | null | undefined | Function type Constructor = new (...args: any[]) => any interface PropOptions { type?: PropType | true | null required?: boolean default?: D | DefaultFactory | null | undefined | object validator?(value: unknown, props: Record): boolean } // see https://github.com/vuejs/vue-next/blob/22717772dd83b67ffaa6ad9805c6269e184c7e41/packages/runtime-core/src/componentProps.ts#L67 type InferType = T extends { type: null | true } ? any : T extends ObjectConstructor | { type: ObjectConstructor } ? Record : T extends Prop ? V : T extends PropOptions ? V : T extends VueTypeDef ? V : T extends VueTypeValidableDef ? V : T type ValidatorFunction = ( value: T, props?: Record, ) => boolean type DefaultFactory = (() => T) | T type DefaultType = T extends NativeType ? T : DefaultFactory interface VueTypeBaseDef< T = unknown, D = DefaultType, U = T extends NativeType ? T : () => T, > extends PropOptions { _vueTypes_name: string type?: PropType readonly def: (def?: D) => this & { default: U } readonly isRequired: this & { required: true } } type VueTypeDef = VueTypeBaseDef interface VueTypeValidableDef> extends VueTypeBaseDef { readonly validate: (fn: V) => this & { validator: V } } type VueProp = VueTypeBaseDef | PropOptions interface VueTypeShape extends VueTypeBaseDef>, () => Partial> { readonly loose: VueTypeLooseShape } interface VueTypeLooseShape extends VueTypeBaseDef< T, DefaultFactory>>, () => Partial & Record > { readonly loose: VueTypeLooseShape readonly _vueTypes_isLoose: true } interface VueTypesDefaults { func: (...args: any[]) => any bool: boolean string: string number: number array: () => any[] object: () => Record integer: number } interface VueTypesConfig { silent: boolean logLevel: 'log' | 'warn' | 'error' | 'debug' | 'info' } declare const config: VueTypesConfig; export { type Constructor as C, type InferType as I, type PropOptions as P, type VueTypeDef as V, type VueTypeValidableDef as a, type ValidatorFunction as b, type VueProp as c, type Prop as d, type VueTypeShape as e, type VueTypesDefaults as f, type VueTypesConfig as g, config as h, type VueTypeLooseShape as i };