From: Cédric Exbrayat Date: Mon, 13 Jan 2020 22:12:45 +0000 (+0100) Subject: fix(types): components options should accept components defined with defineComponent... X-Git-Tag: v3.0.0-alpha.2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=74baea108aa93377c4959f9a6b8bc8f9548700ba;p=thirdparty%2Fvuejs%2Fcore.git fix(types): components options should accept components defined with defineComponent (#602) --- diff --git a/packages/runtime-core/src/apiOptions.ts b/packages/runtime-core/src/apiOptions.ts index ad1ab8676a..2de548cf33 100644 --- a/packages/runtime-core/src/apiOptions.ts +++ b/packages/runtime-core/src/apiOptions.ts @@ -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 + components?: Record< + string, + Component | { new (): ComponentPublicInstance } + > directives?: Record inheritAttrs?: boolean diff --git a/test-dts/defineComponent.test-d.tsx b/test-dts/defineComponent.test-d.tsx index 5ae79cfefc..20ead670e3 100644 --- a/test-dts/defineComponent.test-d.tsx +++ b/test-dts/defineComponent.test-d.tsx @@ -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 } + }) +})