types: support app.component to be `defineComponent` (#9662)

This commit is contained in:
Carlos Rodrigues 2023-11-22 14:18:02 +00:00 committed by GitHub
parent fc772dbf73
commit 1c525f75a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -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<PluginOptions> = (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<string, any> = {}
app.component(
key,
defineComponent({
...aliases[key],
name: key,
aliasName: aliases[key].name
})
)

View File

@ -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<HostElement = any> {
version: string
@ -40,7 +41,7 @@ export interface App<HostElement = any> {
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(