I was going through the Typescript Ecmascript source code. I came across this:
interface FunctionConstructor {
/**
* Creates a new function.
* @param args A list of arguments the function accepts.
*/
new(...args: string[]): Function;
(...args: string[]): Function;
readonly prototype: Function;
}
declare var Function: FunctionConstructor;
I am assuming FunctionConstructor is the type of Function's constructor.
We declaring a Function variable which has FunctionConstructor interface. What are the first two parameters in the FunctionConstructor interface? And why would variable Function(a plain JavaScript object deriving from Object) have its type similar to its constructor?
Basically I am trying to understand what is happening behind the scenes. Any help is appreciated. Thanks!