You will need to change this:
var X = callableType(function() { this.callOverload = function(){console.log('called!')}; });
:
var X = new (callableType(function() { this.callOverload = function(){console.log('called!')}; }));
Notice the new as well as the parentheses around the callableType call.
The brackets allow you to call callableType and return a function that is used as the constructor for new .
EDIT:
var X = callableType(function() { this.callOverload = function() { console.log('called!') }; }); var someType = X();
I really don't know how / where / why you are using this template, but I believe there is a good reason.
user113716 Jul 03 2018-11-17T00: 00Z
source share