import Vue, { PluginObject, VueConstructor } from 'vue'

export type Fn = () => void

export const tuple = <T = string>(...args: T[]): T[] => args

export type SFCWithInstall<T> = T & PluginObject<Record<string, unknown>>

export const withInstall = <T>(comp: T) => {
  const c = comp as SFCWithInstall<T>
  c.install = (app: VueConstructor<Vue>): void => {
    app.component(c.name, c)
  }

  return c as SFCWithInstall<T>
}
