How to import CommonJS module that uses module.exports= in Typescript
<p>The following produces valid, working ES5 but emits the error below. I'm using Typescript 1.7.5 and I think I've read the whole language spec and I cannot figure out why this error is produced. </p>

<pre><code>error TS2349: Cannot invoke an expression whose type lacks a call signature.
</code></pre>

<p><strong>a.js</strong> (ES5 ambient module with default export)
</p>

<pre><code>function myfunc() {
  return "hello";
}
module.exports = myfunc;
</code></pre>

<p><strong>a.d.ts</strong>
</p>

<pre><code>declare module "test" {
    export default function (): string;
}
</code></pre>

<p><strong>b.ts</strong>
</p>

<pre><code>import test = require("test");
const app = test();
</code></pre>

<p><strong>b.js (generated ES5):</strong>
</p>

<pre><code>var test = require("test");
var app = test()
</code></pre>