From 19bd02b6bb1e11f1911c8d3d71ecb9e69331303e Mon Sep 17 00:00:00 2001 From: BTB <1498118157@qq.com> Date: Wed, 28 Sep 2022 16:46:14 +0800 Subject: [PATCH] fix: `withInstallDirective` type error (#9946) Co-authored-by: zz <2418184580@qq.com> --- packages/utils/vue/install.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/utils/vue/install.ts b/packages/utils/vue/install.ts index fe1c512589..08b7fbb793 100644 --- a/packages/utils/vue/install.ts +++ b/packages/utils/vue/install.ts @@ -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 = >( @@ -30,7 +30,10 @@ export const withInstallFunction = (fn: T, name: string) => { return fn as SFCInstallWithContext } -export const withInstallDirective = (directive: T, name: string) => { +export const withInstallDirective = ( + directive: T, + name: string +) => { ;(directive as SFCWithInstall).install = (app: App): void => { app.directive(name, directive) }