title: Can't call method from constructor
body: <p>Calling private/public method from constructor in the same class gives me an error</p>
  
  <blockquote>
    <p>Uncaught TypeError: this.setEventHandler is not a function
        at Object.Init (Init.ts:4)
        at :3:16</p>
  </blockquote>
  
  <pre><code>export class Init {
  
  constructor(private connectBtn: HTMLElement) {
      this.setEventHandler();
  }
  public setEventHandler() {
      this.connectBtn.onclick = (e) =&gt; {
          this.openConnectWindow();
      }
  }
  private openConnectWindow() {
      console.log("OPEN SESAME")
  }
  }
  </code></pre>
  
  <p>This is the compiled javascript</p>
  
  <pre><code>var Init = (function () {
  function Init(connectBtn) {
      this.connectBtn = connectBtn;
      this.setEventHandler();
  }
  Init.prototype.setEventHandler = function () {
      var _this = this;
      this.connectBtn.onclick = function (e) {
          _this.openConnectWindow();
      };
  };
  Init.prototype.openConnectWindow = function () {
      console.log("OPEN SESAME");
  };
  return Init;
  }());
  </code></pre>
  
  <p>Edit: This is for a library.</p>
  
  <p>I tried putting var mylib = new MyLibraryName() but I only get "MyLibraryName is not a constructor". </p>
  
  <p>I start the root object with webpack</p>
  
  <pre><code>output: {
      path: path.join(__dirname, "lib"),
      filename: outputFile,
      library: libraryName,
      libraryTarget: "umd",
      umdNamedDefine: true
  },
  </code></pre>