title: Typescript import from ES2015 export: how to specify type declaration file
body: <p>I'm trying to make a sparse type declaration file for feathersjs so I can better use it in Typescript.</p>
  
  <p>Feathers is written in ES2015 and distributes ES5 (via Babel).
  The ES5 default export:</p>
  
  <pre class="lang-js prettyprint-override"><code>function createApplication() {
    var app = express();
    Proto.mixin(Application, app);
    app.init();
    return app;
  }
  module.exports = createApplication;
  </code></pre>
  
  <p>My type declaration file (feathers.d.ts):
  </p>
  
  <pre><code>declare module "feathers" {
      import * as express from "express";
      import * as serveStatic from 'serve-static';
  
      interface Feathers extends express.Express {
          (func?: express.Express): Feathers;
          setup(): Feathers;
          static: typeof serveStatic;
      }
  
      var createApplication: Feathers;
  
      export default createApplication;
  }
  </code></pre>
  
  <p>My app (server.ts):
  </p>
  
  <pre><code>import feathers from "feathers";
  const app = feathers();
  app.use('/', feathers.static(__dirname)).listen(3001);
  </code></pre>
  
  <p>So far, typescript compiles with no errors, I get all the nice type checking help in the IDE (atom-typescript). Typescript compiles to the following ES5, which does not run because of the <code>.default()</code> resulting from the default export. 
  (server.js):
  </p>
  
  <pre><code>var feathers_1 = require("feathers");
  var app = feathers_1.default();
  app.use('/', feathers_1.default.static(__dirname)).listen(3001);
  </code></pre>
  
  <p>If I change the import statement to:
  </p>
  
  <pre><code>import * as feathers from "feathers";
  </code></pre>
  
  <p>Then the type checking fails and the compiler emits errors, but it does produce running ES5:
  </p>
  
  <pre><code>var feathers = require("feathers");
  var app = feathers();
  app.use('/', feathers.static(__dirname)).listen(3001);
  </code></pre>
  
  <p>The typescript compiler errors are:</p>
  
  <pre><code>error TS2349: Cannot invoke an expression whose type lacks a call signature.
  error TS2339: Property 'static' does not exist on type 'typeof "feathers"'.
  </code></pre>
  
  <p><strong>Question</strong>: Which of the below <code>import</code> statements should be used in this case? Or, what's wrong with the declaration file (listed above)?
  </p>
  
  <pre><code>// import feathers from "feathers"; // no errors, but emits .default object
  // import * as feathers from "feathers"; // errors, but working ES5
  // import feathers = require("feathers"); // errors, but working ES5
  const app = feathers();
  app.use('/', feathers.static(__dirname)).listen(3001);
  </code></pre>