import { AsyncComponentLoader, Component, FunctionalComponent } from 'vue' // eslint-disable-next-line @typescript-eslint/no-explicit-any type Constructor = new (...args: any) => any export type ComponentProps = TComponent extends Constructor ? InstanceType['$props'] : TComponent extends AsyncComponentLoader ? ComponentProps : TComponent extends FunctionalComponent ? T : never type WithPropsArgs> = Omit, E> extends Omit ? [ component: T, props?: Omit & Record ] : [ component: T, props: Omit & Record ] type WithProps> = Omit, E> extends Omit ? { component: T, props?: Omit & Record } : { component: T, props: Omit & Record } export function withProps(...[component, props]: WithPropsArgs): WithProps { return { component, props, } as WithProps } export function withPropsWithoutExcluded(excluded: E | E[], ...[component, props]: WithPropsArgs): WithProps { return { component, props, } as WithProps } export function withPropsWithoutExcludedFactory(prop: E | E[]) { return function(...args: WithPropsArgs): WithProps { return withPropsWithoutExcluded(prop, ...args) } }