import type { CSSProperties, Component, SetupContext, VNode, EmitsOptions, ObjectEmitsOptions } from 'vue'; /** * 只读属性改为可读 */ export type Mutable = { -readonly [P in keyof T]: Mutable; }; /** * 只读属性改为可读及非必须 */ export type MutablePartial = { -readonly [P in keyof T]?: T[P]; }; /** * 样式值 */ export type StyleValue = Partial; /** * 样式多个值 */ export type StyleValues = StyleValue | Array; /** * 类名值 */ export type ClassValue = string | Record; /** * 类名多个值 */ export type ClassValues = ClassValue | Array; /** * 组件属性 */ export type ComponentProps = MutablePartial & { /** 类名 */ class?: ClassValues; /** 样式 */ style?: StyleValues; }; /** * 组件名或组件 */ export type UserComponent = string | Component; /** * 组件事件触发器 */ export type Emitter = SetupContext['emit']; /** * 渲染结果 */ export type ResultNode = string | VNode | Array | undefined; /** * 插槽方法 */ export type SlotFunction = (slotProps?: Record) => ResultNode; /** * 插槽对象 */ export type SlotObject = Record; /** * 组件事件对应的方法 */ export type EmitMethods = T extends string[] ? { [K in T[number]]: (...args: any[]) => void; } : T extends ObjectEmitsOptions ? { [K in string & keyof T]: ( ...args: T[K] extends (...args: infer P) => any ? P : T[K] extends null ? any[] : never ) => void; } : {};