-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
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?
jwbay, dragomirtitian, mysticatea, korytoff, dubbha and 36 morePictor13 and wuguichiroumeiyou
Metadata
Metadata
Assignees
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript