title: How to write a type definition file for a default exported class?
body: <p>I'm trying to write a type definition file for <a href="https://github.com/P0oOOOo0YA/opensubtitles-api" rel="nofollow noreferrer">OpenSubtitles.org api node wrapper</a>. Here is the main file <a href="https://github.com/P0oOOOo0YA/opensubtitles-api/blob/master/index.js" rel="nofollow noreferrer">index.js</a>. On line 7 the <code>OpenSubtitles</code> class is exported as module's default export. </p>
  
  <pre><code>module.exports = class OpenSubtitles {
  ....
  }
  </code></pre>
  
  <p>So i came up with the following</p>
  
  <pre><code>declare module "opensubtitles-api" {
    export default class OpenSubtitles {
    }
  }
  </code></pre>
  
  <p>This is the transpilation of a code using <code>OpenSubtitles.org api node wrapper</code> and my .d.ts file.</p>
  
  <pre><code>"use strict";
  exports.__esModule = true;
  var opensubtitles_api_1 = require("opensubtitles-api");
  var os = new opensubtitles_api_1["default"]({
      useragent: "TemporaryUserAgent"
  });
  </code></pre>
  
  <p>and when i run it. I get this error.</p>
  
  <pre><code>var os = new opensubtitles_api_1["default"]({
           ^
  
  TypeError: opensubtitles_api_1.default is not a constructor
  </code></pre>
  
  <p>When i remove the <code>["default"]</code> part of the transpiled code everying work as expectd.</p>
  
  <h2>Desired transpilation</h2>
  
  <pre><code>"use strict";
  exports.__esModule = true;
  var opensubtitles_api_1 = require("opensubtitles-api");
  var os = new opensubtitles_api_1({
      useragent: "TemporaryUserAgent"
  });
  </code></pre>
  
  <p>How should i export/declare <code>OpenSubtitles</code> class?</p>