Skip to content

Commit 74baea1

Browse files
cexbrayatyyx990803
authored andcommitted
fix(types): components options should accept components defined with defineComponent (#602)
1 parent 63a6563 commit 74baea1

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

packages/runtime-core/src/apiOptions.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ export interface ComponentOptionsBase<
6363
// Luckily `render()` doesn't need any arguments nor does it care about return
6464
// type.
6565
render?: Function
66-
components?: Record<string, Component>
66+
components?: Record<
67+
string,
68+
Component | { new (): ComponentPublicInstance<any, any, any, any, any> }
69+
>
6770
directives?: Record<string, Directive>
6871
inheritAttrs?: boolean
6972

test-dts/defineComponent.test-d.tsx

+8
Original file line numberDiff line numberDiff line change
@@ -259,3 +259,11 @@ describe('compatibility w/ createApp', () => {
259259
})
260260
createApp().mount(comp3, '#hello')
261261
})
262+
263+
describe('defineComponent', () => {
264+
test('should accept components defined with defineComponent')
265+
const comp = defineComponent({})
266+
defineComponent({
267+
components: { comp }
268+
})
269+
})

0 commit comments

Comments
 (0)