Skip to content

Commit

Permalink
fix(types): components options should accept components defined with …
Browse files Browse the repository at this point in the history
…defineComponent (#602)
  • Loading branch information
cexbrayat authored and yyx990803 committed Jan 13, 2020
1 parent 63a6563 commit 74baea1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/runtime-core/src/apiOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 8 additions & 0 deletions test-dts/defineComponent.test-d.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
})
})

0 comments on commit 74baea1

Please sign in to comment.