From 47453f102e0293f89b518d35a6ae5a0bb8ff8234 Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 29 Apr 2024 10:58:19 +0800 Subject: [PATCH] types: match CompatVue app.use type to standard version close #5760 --- packages/runtime-core/src/compat/global.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/runtime-core/src/compat/global.ts b/packages/runtime-core/src/compat/global.ts index 1c633ed52..22f7b5213 100644 --- a/packages/runtime-core/src/compat/global.ts +++ b/packages/runtime-core/src/compat/global.ts @@ -77,7 +77,12 @@ export type CompatVue = Pick & { nextTick: typeof nextTick - use(plugin: Plugin, ...options: any[]): CompatVue + use( + plugin: Plugin, + ...options: Options + ): CompatVue + use(plugin: Plugin, options: Options): CompatVue + mixin(mixin: ComponentOptions): CompatVue component(name: string): Component | undefined @@ -176,11 +181,11 @@ export function createCompatVue( Vue.version = `2.6.14-compat:${__VERSION__}` Vue.config = singletonApp.config - Vue.use = (p, ...options) => { - if (p && isFunction(p.install)) { - p.install(Vue as any, ...options) - } else if (isFunction(p)) { - p(Vue as any, ...options) + Vue.use = (plugin: Plugin, ...options: any[]) => { + if (plugin && isFunction(plugin.install)) { + plugin.install(Vue as any, ...options) + } else if (isFunction(plugin)) { + plugin(Vue as any, ...options) } return Vue }