fix(types): app.component should accept defineComponent return type (#822)

fix #730
This commit is contained in:
hareku 2020-03-12 23:19:30 +09:00 committed by GitHub
parent 4dfd4b8dbd
commit 1e9d1319c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,8 +17,8 @@ export interface App<HostElement = any> {
config: AppConfig
use(plugin: Plugin, ...options: any[]): this
mixin(mixin: ComponentOptions): this
component(name: string): Component | undefined
component(name: string, component: Component): this
component(name: string): PublicAPIComponent | undefined
component(name: string, component: PublicAPIComponent): this
directive(name: string): Directive | undefined
directive(name: string, directive: Directive): this
mount(
@ -55,7 +55,7 @@ export interface AppConfig {
export interface AppContext {
config: AppConfig
mixins: ComponentOptions[]
components: Record<string, Component>
components: Record<string, PublicAPIComponent>
directives: Record<string, Directive>
provides: Record<string | symbol, any>
reload?: () => void // HMR only
@ -168,7 +168,7 @@ export function createAppAPI<HostNode, HostElement>(
if (__DEV__ && context.components[name]) {
warn(`Component "${name}" has already been registered in target app.`)
}
context.components[name] = component as Component
context.components[name] = component
return app
},