import type { App } from 'vue' import type { SFCWithInstall } from './types' import { NOOP } from './types' export const withNoopInstall = (component: T) => { ;(component as SFCWithInstall).install = NOOP return component as SFCWithInstall } // eslint-disable-next-line @typescript-eslint/no-explicit-any export const withInstall = >(main: T, extra?: E) => { ;(main as SFCWithInstall).install = (app: App): void => { for (const comp of [main, ...Object.values(extra ?? {})]) { app.component(comp.name, comp) } } if (extra) { for (const [key, comp] of Object.entries(extra)) { // eslint-disable-next-line @typescript-eslint/no-explicit-any ;(main as any)[key] = comp } } return main as SFCWithInstall & E }