element-plus/packages/utils/with-install.ts
2021-09-10 10:04:09 +08:00

11 lines
344 B
TypeScript

import type { App, DefineComponent } from 'vue'
import type { SFCWithInstall } from './types'
/* istanbul ignore next */
export default <T extends DefineComponent<any, any, any>>(component: T) => {
;(component as any).install = (app: App): void => {
app.component(component.name, component)
}
return component as SFCWithInstall<T>
}