import type { ComponentObjectPropsOptions, Prop, PropType } from 'vue'; /** * Creates a factory function for props definitions. * This is used to define props in a composable then override * default values in an implementing component. * * @example Simplified signature * (props: Props) => (defaults?: Record) => Props * * @example Usage * const makeProps = propsFactory({ * foo: String, * }) * * defineComponent({ * props: { * ...makeProps({ * foo: 'a', * }), * }, * setup (props) { * // would be "string | undefined", now "string" because a default has been provided * props.foo * }, * } */ export declare function propsFactory(props: PropsOptions, source?: string): = {}>(defaults?: Defaults | undefined) => AppendDefault; declare type AppendDefault> = { [P in keyof T]-?: unknown extends D[P] ? T[P] : T[P] extends Record ? Omit & { type: PropType>; default: MergeDefault; } : { type: PropType>; default: MergeDefault; }; }; declare type MergeDefault = unknown extends D ? InferPropType : (NonNullable> | D); /** * Like `Partial` but doesn't care what the value is */ declare type PartialKeys = { [P in keyof T]?: unknown; }; declare type InferPropType = T extends null ? any : T extends { type: null | true; } ? any : T extends ObjectConstructor | { type: ObjectConstructor; } ? Record : T extends BooleanConstructor | { type: BooleanConstructor; } ? boolean : T extends Prop ? (unknown extends V ? D : V) : T; export {};