mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-07 23:37:35 +08:00
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user