title: Javascript es6 override static properties
body: <p>Trying out ES6 and tried to create a class with static properties and function for parsing. Then I want to extend the base parser for each different type I am parsing. Not sure if I am doing a anti-pattern but I cannot override static properties.</p>
  
  <p>This is my base parser</p>
  
  <pre><code>class Module {
  
    static name = 'Default Module'
    static version = {major:10000, minor: 10000}
  
    static checkVersion({majorVersion = 10000, minorVersion = 10000}) {
      if(this.version.major !== majorVersion || this.version.minor &gt; minorVersion) {
        throw `${this.name} requires version ${this.version.major}.${this.version.minor} got ${majorVersion}.${minorVersion}`;
      }
    }
  
    static parse(data) {
      try {
        this.checkVersion(data);
        return this.internalParser(data);
  
      } catch (e) {
        throw e;
      }
    }
  
    static internalParser(data) {
      throw `${this.name} has no parser implemented`;
    }
  }
  </code></pre>
  
  <p>And then I want to extend like this</p>
  
  <pre><code>class ExtendedModule extends Module {
    static name = 'Extended';
    static version = {major: 1, minor:0}
  
    static internalParser(data) {
      //Some stuff
    }
  }
  </code></pre>
  
  <p>But when compiling in node with babel I get</p>
  
  <pre><code>true; if ('value' in descriptor) descriptor.writable = true; Object.defineProp
                                                                      ^
  TypeError: Cannot redefine property: name
      at Function.defineProperty (native)
  </code></pre>
  
  <p>Anyone got a clue if this is even possible or just plain wrong?</p>