You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is little info about NewableFunction except for the meeting notes in #27102 and the pr #27028.
As far as I understand the comments there, a NewableFunction should be "callable" with new Foo(...), right? Or do we have to stick with apply(...)/call(...)?
Example:
classFoo{}functiondoSomething(clazz: NewableFunction){newclazz();// This expression is not constructable.// Type 'NewableFunction' has no construct signatures}doSomething(Foo);// passes but would fail with "normal functions" aka. CallableFunction
Question about workaround:
If NewableFunction works as desired should we stick with new Function.prototype.bind.call(clazz, undefined); or should we define our own "ConstructableFunction" (a lot of people suggest this and even angular did it):
Activity
rajmondx commentedon May 30, 2021
Ended up using something like this: