Re-add generic Function type to IInjector.invoke() sygnature. (#16042)

Looks like it is used in some projects. 'Function' should be treated
as a function with '(..args: any[]) => any' signature.
This commit is contained in:
Mateusz
2017-04-26 11:47:36 -07:00
committed by Sheetal Nandi
parent ecd2bdb304
commit d5240b6d9c
2 changed files with 9 additions and 1 deletions
+8 -1
View File
@@ -484,7 +484,14 @@ namespace TestInjector {
function foobar(v: boolean): number {
return 7;
}
let result: number = $injector.invoke(foobar);
let result = $injector.invoke(foobar);
if (!(typeof result === 'number')) {
// This fails to compile if 'result' is not exactly a number.
let expectNever: never = result;
}
let anyFunction: Function = foobar;
let anyResult: string = $injector.invoke(anyFunction);
}
}
+1
View File
@@ -1981,6 +1981,7 @@ declare namespace angular {
instantiate<T>(typeConstructor: {new(...args: any[]): T}, locals?: any): T;
invoke(inlineAnnotatedFunction: any[]): any;
invoke<T>(func: (...args: any[]) => T, context?: any, locals?: any): T;
invoke(func: Function, context?: any, locals?: any): any;
strictDi: boolean;
}