michael.lee.theriot at gmail.com (2017-08-09T04:36:18.313Z)
Subclassing can work too.
```js
class A {
constructor() {
this.bar = 1;
this.baz = 2;
if (new.target === A) Object.preventExtensions(this);
}
}
class B extends A {
constructor() {
super();
this.bat = 3;
if (new.target === B) Object.preventExtensions(this);
}
}
```
No decorator needed to do this today.
I am not keeping up with decorators but @sealed implies to me that the
class cannot be subclassed? At least that's what it means in C# and would
confuse me if it simply meant Object.seal(this)...
Subclassing can work too. ```js class A { constructor() { this.bar = 1; this.baz = 2; if (new.target === A) Object.preventExtensions(this); } } class B extends A { constructor() { super(); this.bat = 3; if (new.target === B) Object.preventExtensions(this); } } ``` No decorator needed to do this today. I am not keeping up with decorators but @sealed implies to me that the class cannot be subclassed? At least that's what it means in C# and would confuse me if it simply meant Object.seal(this)... -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170808/7179fe17/attachment.html>