fix(types): fix app.component() typing with inline defineComponent

close #10843
This commit is contained in:
Evan You 2024-05-03 16:29:23 -07:00
parent eae0ccb8e0
commit 908f70adc0
No known key found for this signature in database
GPG Key ID: B9D421896CA450FB
2 changed files with 18 additions and 1 deletions

View File

@ -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 {}
},
}),
)

View File

@ -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(