fix(types): components options should accept components defined with defineComponent (#602)

This commit is contained in:
Cédric Exbrayat 2020-01-13 23:12:45 +01:00 committed by Evan You
parent 63a6563106
commit 74baea108a
2 changed files with 12 additions and 1 deletions

View File

@ -63,7 +63,10 @@ export interface ComponentOptionsBase<
// Luckily `render()` doesn't need any arguments nor does it care about return // Luckily `render()` doesn't need any arguments nor does it care about return
// type. // type.
render?: Function render?: Function
components?: Record<string, Component> components?: Record<
string,
Component | { new (): ComponentPublicInstance<any, any, any, any, any> }
>
directives?: Record<string, Directive> directives?: Record<string, Directive>
inheritAttrs?: boolean inheritAttrs?: boolean

View File

@ -259,3 +259,11 @@ describe('compatibility w/ createApp', () => {
}) })
createApp().mount(comp3, '#hello') createApp().mount(comp3, '#hello')
}) })
describe('defineComponent', () => {
test('should accept components defined with defineComponent')
const comp = defineComponent({})
defineComponent({
components: { comp }
})
})