Merge pull request #15974 from mgr01/injector

Angular: Improve types of 'instantiate' and 'invoke' of IInjectorService.
This commit is contained in:
Ryan Cavanaugh
2017-04-19 13:06:50 -07:00
committed by GitHub
2 changed files with 18 additions and 2 deletions
+16
View File
@@ -470,6 +470,22 @@ namespace TestInjector {
$injector.annotate(() => {});
$injector.annotate(() => {}, true);
// $injector.instantiate
{
class Foobar {
constructor($q) {}
}
let result: Foobar = $injector.instantiate(Foobar);
}
// $injector.invoke
{
function foobar(v: boolean): number {
return 7;
}
let result: number = $injector.invoke(foobar);
}
}
// Promise signature tests
+2 -2
View File
@@ -1978,9 +1978,9 @@ declare namespace angular {
get(name: '$window'): IWindowService;
get<T>(name: '$xhrFactory'): IXhrFactory<T>;
has(name: string): boolean;
instantiate<T>(typeConstructor: Function, locals?: any): T;
instantiate<T>(typeConstructor: {new(...args: any[]): T}, locals?: any): T;
invoke(inlineAnnotatedFunction: any[]): any;
invoke(func: Function, context?: any, locals?: any): any;
invoke<T>(func: (...args: any[]) => T, context?: any, locals?: any): T;
strictDi: boolean;
}