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 20:47:36 +02:00
committed by Sheetal Nandi
parent ecd2bdb304
commit d5240b6d9c
2 changed files with 9 additions and 1 deletions

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);
}
}