title: Extending Record in Immutable.js
body: <p>I’m using Immuatable.js, and I wanted to extend Immutable.Record so I have a class that works identically but adds some default properties and functions.</p>
  
  <p>Looking at the source, Record.js is an ES6 class that extends KeyedCollection but returns a function from the constructor.</p>
  
  <p><a href="https://github.com/facebook/immutable-js/blob/master/src/Record.js" rel="nofollow noreferrer">https://github.com/facebook/immutable-js/blob/master/src/Record.js</a></p>
  
  <p>I don't really understand the side effects of doing that.</p>
  
  <p>Basically I'd like a FooRecord class where I can do this:</p>
  
  <pre><code>class FooifiedRecord extends FooRecord({
    name: '',
  }){
    sayMyName(){
      return this.name;
    }
  };
  </code></pre>
  
  <p>And it's equivalent to this:</p>
  
  <pre><code>class FooifiedRecord extends Immutable.Record({
    name: '',
    foo: '',
  }) {
    doFoo(){
      return this.foo + ' bar';
    }
    sayMyName(){
      return this.name;
    }
  }
  </code></pre>
  
  <p>But I'm not sure about the correct syntax.</p>
  
  <p>EDIT: Not remotely similar to <a href="https://stackoverflow.com/questions/34922321/how-to-construct-subclasses-of-immutable-record">How to construct subclasses of Immutable.Record?</a>, that covers basic use of Immutable.Record. I'm wondering how to extend it.</p>