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)...
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to