title: Override constructor with an class decorator?
body: <p>How can I override a constructor with an ES7 class decorator?</p>
  
  <p>For example, I'd like to have something like:</p>
  
  <pre><code>@injectAttributes({ foo: 42 })
  class Bar {
    constructor() {
      console.log(this.foo);
    }
  }
  </code></pre>
  
  <p>Where the <code>injectAttributes</code> decorator will inject attributes into new instances before they are created:</p>
  
  <pre><code>&gt; bar = new Bar();
  42
  &gt; bar.foo
  42
  </code></pre>
  
  <p>The obvious solution – using a different constructor:</p>
  
  <pre><code> function overrideConstructor(cls, attrs) {
     Object.assign(this, attrs);
     cls.call(this);
   }
  </code></pre>
  
  <p>Does not work because the object created will be an instance of the new constructor, not the original type:</p>
  
  <pre><code> &gt; bar = new overrideConstructor(Bar, {foo: 42})
   42
   &gt; bar
   [overrideConstructor {}]
   &gt; bar instanceof Bar
   false
  </code></pre>