Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(runtime-core): components options should accept components define… #602

Merged
merged 1 commit into from
Jan 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }
})
})