From ef5b10b9b93995f642847f3d848df5808d5ee058 Mon Sep 17 00:00:00 2001 From: qmhc <544022268@qq.com> Date: Mon, 7 Nov 2022 23:04:12 +0800 Subject: [PATCH] types: add app.use type infer --- packages/runtime-core/src/apiCreateApp.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/runtime-core/src/apiCreateApp.ts b/packages/runtime-core/src/apiCreateApp.ts index 1c588dbc8f8..ca124463efb 100644 --- a/packages/runtime-core/src/apiCreateApp.ts +++ b/packages/runtime-core/src/apiCreateApp.ts @@ -31,7 +31,7 @@ import { ObjectEmitsOptions } from './componentEmits' export interface App { version: string config: AppConfig - use(plugin: Plugin, ...options: any[]): this + use(plugin: Plugin, ...options: A): this mixin(mixin: ComponentOptions): this component(name: string): Component | undefined component(name: string, component: Component): this @@ -140,12 +140,12 @@ export interface AppContext { filters?: Record } -type PluginInstallFunction = (app: App, ...options: any[]) => any +type PluginInstallFunction = (app: App, ...options: A) => any -export type Plugin = - | (PluginInstallFunction & { install?: PluginInstallFunction }) +export type Plugin = + | (PluginInstallFunction & { install?: PluginInstallFunction }) | { - install: PluginInstallFunction + install: PluginInstallFunction } export function createAppContext(): AppContext {