This code:
let arrowFn = () => {};
arrowFn.prototype.blah;
throws an error at compile time because arrow function don't have prototypes but typescript doesn't error and happily transpile the code.
Why?
Here you have built in FUnction type:
interface Function {
/**
* Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function.
* @param thisArg The object to be used as the this object.
* @param argArray A set of arguments to be passed to the function.
*/
apply(this: Function, thisArg: any, argArray?: any): any;
/**
* Calls a method of an object, substituting another object for the current object.
* @param thisArg The object to be used as the current object.
* @param argArray A list of arguments to be passed to the method.
*/
call(this: Function, thisArg: any, ...argArray: any[]): any;
/**
* For a given function, creates a bound function that has the same body as the original function.
* The this object of the bound function is associated with the specified object, and has the specified initial parameters.
* @param thisArg An object to which the this keyword can refer inside the new function.
* @param argArray A list of arguments to be passed to the new function.
*/
bind(this: Function, thisArg: any, ...argArray: any[]): any;
/** Returns a string representation of a function. */
toString(): string;
prototype: any;
readonly length: number;
// Non-standard extensions
arguments: any;
caller: Function;
}
As you see, FUnction.prototype has any type. That's why you don't have any error.
let arrowFn = () => {};
function x(){}
x.prototype
arrowFn.prototype
Both x and arrowFn refering to same Function.prototype type.
If you replace your arrow function with function allowFn(){}, you will receive just undefined, without error
UPDATE
const x = () => { }
const y = function () { }
function z() { }
type X = typeof x // () => void
type Y = typeof y // () => void
type Z = typeof z // () => void