]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(types): components options should accept components defined with defineComponent...
authorCédric Exbrayat <cexbrayat@users.noreply.github.com>
Mon, 13 Jan 2020 22:12:45 +0000 (23:12 +0100)
committerEvan You <yyx990803@gmail.com>
Mon, 13 Jan 2020 22:12:45 +0000 (17:12 -0500)
packages/runtime-core/src/apiOptions.ts
test-dts/defineComponent.test-d.tsx

index ad1ab8676a5cdc9580bc551b653e9608498aefc2..2de548cf3354515381ca1a4ec14f69a93dbcfb17 100644 (file)
@@ -63,7 +63,10 @@ export interface ComponentOptionsBase<
   // Luckily `render()` doesn't need any arguments nor does it care about return
   // type.
   render?: Function
-  components?: Record<string, Component>
+  components?: Record<
+    string,
+    Component | { new (): ComponentPublicInstance<any, any, any, any, any> }
+  >
   directives?: Record<string, Directive>
   inheritAttrs?: boolean
 
index 5ae79cfefc963c8441aef3d7a595a0cad03d423c..20ead670e3e835784d6af7b05a781bc6c856d00d 100644 (file)
@@ -259,3 +259,11 @@ describe('compatibility w/ createApp', () => {
   })
   createApp().mount(comp3, '#hello')
 })
+
+describe('defineComponent', () => {
+  test('should accept components defined with defineComponent')
+  const comp = defineComponent({})
+  defineComponent({
+    components: { comp }
+  })
+})