mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
fix: withInstallDirective type error (#9946)
Co-authored-by: zz <2418184580@qq.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { NOOP } from '@vue/shared'
|
||||
|
||||
import type { App } from 'vue'
|
||||
import type { App, Directive } from 'vue'
|
||||
import type { SFCInstallWithContext, SFCWithInstall } from './typescript'
|
||||
|
||||
export const withInstall = <T, E extends Record<string, any>>(
|
||||
@@ -30,7 +30,10 @@ export const withInstallFunction = <T>(fn: T, name: string) => {
|
||||
return fn as SFCInstallWithContext<T>
|
||||
}
|
||||
|
||||
export const withInstallDirective = <T>(directive: T, name: string) => {
|
||||
export const withInstallDirective = <T extends Directive>(
|
||||
directive: T,
|
||||
name: string
|
||||
) => {
|
||||
;(directive as SFCWithInstall<T>).install = (app: App): void => {
|
||||
app.directive(name, directive)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user