feat(apiApp): return app from provide method for chaining (#393)

This commit is contained in:
Dmitry Sharshakov 2019-10-28 03:54:33 +03:00 committed by Evan You
parent a8aa328907
commit e581b14dff

View File

@ -21,7 +21,7 @@ export interface App<HostElement = any> {
rootContainer: HostElement | string, rootContainer: HostElement | string,
rootProps?: Data rootProps?: Data
): ComponentPublicInstance ): ComponentPublicInstance
provide<T>(key: InjectionKey<T> | string, value: T): void provide<T>(key: InjectionKey<T> | string, value: T): this
} }
export interface AppConfig { export interface AppConfig {
@ -169,6 +169,8 @@ export function createAppAPI<HostNode, HostElement>(
// TypeScript doesn't allow symbols as index type // TypeScript doesn't allow symbols as index type
// https://github.com/Microsoft/TypeScript/issues/24587 // https://github.com/Microsoft/TypeScript/issues/24587
context.provides[key as string] = value context.provides[key as string] = value
return app
} }
} }