Skip to content

Commit

Permalink
fix(types): fix app.component() typing with inline defineComponent
Browse files Browse the repository at this point in the history
close #10843
  • Loading branch information
yyx990803 committed May 3, 2024
1 parent eae0ccb commit 908f70a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
14 changes: 14 additions & 0 deletions packages/dts-test/defineComponent.test-d.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1959,3 +1959,17 @@ declare const ErrorMessage: {
}
})
;<ErrorMessage name="password" class="error" />

// #10843
createApp({}).component(
'SomeComponent',
defineComponent({
props: {
title: String,
},
setup(props) {
expectType<string | undefined>(props.title)
return {}
},
}),
)
5 changes: 4 additions & 1 deletion packages/runtime-core/src/apiCreateApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ export interface App<HostElement = any> {

mixin(mixin: ComponentOptions): this
component(name: string): Component | undefined
component(name: string, component: Component | DefineComponent): this
component<T extends Component | DefineComponent>(
name: string,
component: T,
): this
directive<T = any, V = any>(name: string): Directive<T, V> | undefined
directive<T = any, V = any>(name: string, directive: Directive<T, V>): this
mount(
Expand Down

0 comments on commit 908f70a

Please sign in to comment.