]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
types: match CompatVue app.use type to standard version
authorEvan You <yyx990803@gmail.com>
Mon, 29 Apr 2024 02:58:19 +0000 (10:58 +0800)
committerEvan You <yyx990803@gmail.com>
Mon, 29 Apr 2024 02:58:19 +0000 (10:58 +0800)
close #5760

packages/runtime-core/src/compat/global.ts

index 1c633ed52a3708e3fa64823bcd0182a49c5f8af5..22f7b5213964513cf9f28106e09fd20f9c26e0ae 100644 (file)
@@ -77,7 +77,12 @@ export type CompatVue = Pick<App, 'version' | 'component' | 'directive'> & {
 
   nextTick: typeof nextTick
 
-  use(plugin: Plugin, ...options: any[]): CompatVue
+  use<Options extends unknown[]>(
+    plugin: Plugin<Options>,
+    ...options: Options
+  ): CompatVue
+  use<Options>(plugin: Plugin<Options>, 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
   }