Skip to content

Commit

Permalink
types: match CompatVue app.use type to standard version
Browse files Browse the repository at this point in the history
close #5760
  • Loading branch information
yyx990803 committed Apr 29, 2024
1 parent 41df250 commit 47453f1
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions packages/runtime-core/src/compat/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 47453f1

Please sign in to comment.