Круто.
@abstract class Model {
constructor(data) {
Object.assign(this, data);
}
}
console.log(new Model()); //TypeError: Cannot directly instantiate an abstract class
function abstract(target) {
return new Proxy(target, {
construct() {
throw new TypeError("Cannot directly instantiate an abstract class");
}
})
}