title: Cannot invoke an expression whose type lacks a call signature, while it has a signature
body: <p>I am trying to define types for a module I installed via npm. </p>
  
  <p>This is the <a href="https://github.com/Loupax/zero-fill/blob/master/index.js" rel="nofollow noreferrer">exported module</a>. I'd rather not make changes to this file since I'd like to merge back to the original repo without introducing BCs</p>
  
  <pre><code>/**
   * Given a number, return a zero-filled string.
   * From http://stackoverflow.com/questions/1267283/
   * @param  {number} width
   * @param  {number} number
   * @return {string}
   */
  module.exports = function zeroFill (width, number, pad) {
    if (number === undefined) {
      return function (number, pad) {
        return zeroFill(width, number, pad)
      }
    }
    if (pad === undefined) pad = '0'
    width -= number.toString().length
    if (width &gt; 0) return new Array(width + (/\./.test(number) ? 2 : 1)).join(pad) + number
    return number + ''
  }
  </code></pre>
  
  <p>This is the definition I wrote for <a href="https://github.com/Loupax/zero-fill/blob/master/index.d.ts" rel="nofollow noreferrer">this file</a></p>
  
  <pre><code>declare module "zero-fill"{
      export default function zeroFill(width:number, num:number, pad?:string|number):string;
      export default function zeroFill(width:number):{(num:number, pad?:string|number):string};
  }
  </code></pre>
  
  <p>And here is an example usage:</p>
  
  <pre><code>import * as zeroFill from "zero-fill";
  zeroFill(2,0);
  </code></pre>
  
  <p>What confuses me is that the compiler both gives me this error:</p>
  
  <pre><code>Cannot invoke an expression whose type lacks a call signature. Type 'typeof "zero-fill"' has no compatible call signatures.
  </code></pre>
  
  <p>while at the same time it compiles the typescript and I see it running in the browser. What seems to be the problem?</p>