]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
types: support app.component to be `defineComponent` (#9662)
authorCarlos Rodrigues <carlos@hypermob.co.uk>
Wed, 22 Nov 2023 14:18:02 +0000 (14:18 +0000)
committerGitHub <noreply@github.com>
Wed, 22 Nov 2023 14:18:02 +0000 (22:18 +0800)
packages/dts-test/appUse.test-d.ts
packages/runtime-core/src/apiCreateApp.ts

index c1bebcd53e369ab1e58271cdc82cfc7c8bc00f12..ebfc986a757942266bc2173602f5deae1df3b909 100644 (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
+  })
+)
index 8e4ab1f3aa0ca71998e503147fee96d7ea93177f..8e58e69378e0c522f833fed871a2bdc5e0238947 100644 (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(