Closed rafaferry closed 6 years ago
Hello,
Thanks for the report, Indeed, duck typing does not use the new
operator.
Object Models can be instanciated with or without new
thanks to a additional check I added in their constructor code. But in the case of ES6 classes, the ES6 specification explicitely requires that classes have to be instanciated with new
.
On the other hand, when duck typing is used on some primitives, the new
operator may cause unexpected issues such as converting to primitive wrappers (i.e. string => String). I need to make additional checks. Bugfix coming tonight hopefully
Hello,
I'm trying to use objectmodel with ES6 classes, but it seems that duck typing is not working. The message that the framework gives is: "Class constructor Person cannot be invoked without 'new'"
Here is a mocha test:
if i change to
it works, but then I dont have the ducktyping.
[]s