mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00: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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user