types: fix + test inject API typing

ref: #2052
This commit is contained in:
Evan You
2020-09-14 21:26:28 -04:00
parent b29bc0d694
commit b2dc95378d
2 changed files with 21 additions and 1 deletions

View File

@@ -31,7 +31,12 @@ export function inject<T>(key: InjectionKey<T> | string): T | undefined
export function inject<T>(
key: InjectionKey<T> | string,
defaultValue: T,
treatDefaultAsFactory?: boolean
treatDefaultAsFactory?: false
): T
export function inject<T>(
key: InjectionKey<T> | string,
defaultValue: T | (() => T),
treatDefaultAsFactory: true
): T
export function inject(
key: InjectionKey<any> | string,