diff --git a/packages/dts-test/appUse.test-d.ts b/packages/dts-test/appUse.test-d.ts index c1bebcd53e3..ebfc986a757 100644 --- a/packages/dts-test/appUse.test-d.ts +++ b/packages/dts-test/appUse.test-d.ts @@ -1,4 +1,4 @@ -import { createApp, App, Plugin } from 'vue' +import { createApp, App, Plugin, defineComponent } from 'vue' const app = createApp({}) @@ -93,3 +93,15 @@ const PluginTyped: Plugin = (app, options) => {} // @ts-expect-error: needs options app.use(PluginTyped) app.use(PluginTyped, { option2: 2, option3: true }) + +// vuetify usage +const key: string = '' +const aliases: Record = {} +app.component( + key, + defineComponent({ + ...aliases[key], + name: key, + aliasName: aliases[key].name + }) +) diff --git a/packages/runtime-core/src/apiCreateApp.ts b/packages/runtime-core/src/apiCreateApp.ts index 8e4ab1f3aa0..8e58e69378e 100644 --- a/packages/runtime-core/src/apiCreateApp.ts +++ b/packages/runtime-core/src/apiCreateApp.ts @@ -27,6 +27,7 @@ import { version } from '.' import { installAppCompatProperties } from './compat/global' import { NormalizedPropsOptions } from './componentProps' import { ObjectEmitsOptions } from './componentEmits' +import { DefineComponent } from './apiDefineComponent' export interface App { version: string @@ -40,7 +41,7 @@ export interface App { mixin(mixin: ComponentOptions): this component(name: string): Component | undefined - component(name: string, component: Component): this + component(name: string, component: Component | DefineComponent): this directive(name: string): Directive | undefined directive(name: string, directive: Directive): this mount(