title: How to type a untyped package from NPM?
body: <p>I'm learning typescript and I couldn't find the answer for this anywhere: </p>
  
  <p>Suppose I have a module <code>./node_modules/do-something</code> that is written in plain JS:</p>
  
  <pre class="lang-js prettyprint-override"><code>function doSometing(a = '', b = {}) {
    console.log(a);
    console.log(b);
  
    return `${a}`;
  }
  
  module.exports = doSometing;
  </code></pre>
  
  <p>And I want to write type definitions for it. How should I go about doing?</p>
  
  <p>I've tried:</p>
  
  <pre class="lang-js prettyprint-override"><code>// do-someting/index.d.ts
  
  declare module 'do-something' {
    export default interface doSometing {
      (a: string, b?: any): string
    }
  }
  </code></pre>
  
  <p>But I always get <code>Cannot augment module 'do-something' because it resolves to a non-module entity</code>.</p>
  
  <p>How should I go about typing it?</p>