@strict class decorator
Michael Theriot
michael.lee.theriot at gmail.com
Wed Aug 9 04:34:06 UTC 2017
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>
More information about the es-discuss
mailing list