import { Prop, ComponentObjectPropsOptions } from '../shims-vue'; import { 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) => AppendDefault; export type AppendDefault> = { [P in keyof T]-?: unknown extends D[P] ? T[P] : T[P] extends Record ? Omit & { type: PropType>; default: MergeDefaults; } : { type: PropType>; default: MergeDefaults; }; }; type MergeDefaults = unknown extends D ? InferPropType : NonNullable> | D; /** * Like `Partial` but doesn't care what the value is */ type PartialKeys = { [P in keyof T]?: unknown; }; 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 {};