Obviously all functions have type Function. And likewise all functions can be given the type
type AnyFunc = (...args: any[]) => any;
AFAIK, there is nothing one can do with something of type Function that cannot be done with something of type AnyFunc and vice versa. However they are not equivalently assignable:
(f: AnyFunc): Function => f;
(f: Function): AnyFunc => f;
// ^
// Type 'Function' is not assignable to type 'AnyFunc'.
// Type 'Function' provides no match for the signature '(...args: any[]): any'.
If I edit lib.d.ts to add a callable signature to Function:
interface Function {
(...argArray: any[]): any;
//...
}
it seems to "fix" this issue; is there any reason not to make this change for real?
Obviously all functions have type
Function. And likewise all functions can be given the typeAFAIK, there is nothing one can do with something of type
Functionthat cannot be done with something of typeAnyFuncand vice versa. However they are not equivalently assignable:If I edit
lib.d.tsto add a callable signature toFunction:it seems to "fix" this issue; is there any reason not to make this change for real?