title: TypeScript: How to define custom typings for installed npm package?
body: <p>I like to use <a href="http://npmjs.com/package/rx-node" rel="noreferrer">rx-node</a> within TypeScript</p>
  
  <pre><code>import RxNode from 'rx-node';
  </code></pre>
  
  <p>I installed <a href="http://npmjs.com/package/rx-node" rel="noreferrer">rx-node</a> using npm</p>
  
  <pre><code>$ npm install rx-node --save
  </code></pre>
  
  <p>I searched for type definitions, but without any result</p>
  
  <pre><code>$ typings search rx-node
  No results found for search
  </code></pre>
  
  <p>How can I define custom type definitions for the installed npm module <a href="http://npmjs.com/package/rx-node" rel="noreferrer">rx-node</a>? Where should I store the type definition file? How to configure TypeScript (<em>tsconfig.json</em> and <em>typings.json</em>)?</p>
  
  <p><strong>Edit:</strong> Thanks to <a href="https://stackoverflow.com/a/37642950/1065654">Aleksey L.</a> and <a href="https://stackoverflow.com/a/37642510/1065654">David Bohunek</a> I achieved to define a <code>rx-node.d.ts</code> that looks like this</p>
  
  <pre><code>declare module "rx-node" {
    import {Observable} from '@reactivex/rxjs';
    import {ReadLine} from "readline";
  
    function fromReadLineStream(stream: ReadLine): Observable&lt;string&gt;
  }
  </code></pre>
  
  <p>I installed <a href="https://github.com/ReactiveX/rxjs#all-module-types-cjses6amdtypescript-via-npm" rel="noreferrer">@reactivex/rxjs</a></p>
  
  <pre><code>npm install --save @reactivex/rxjs
  </code></pre>
  
  <p>Since I got an error</p>
  
  <pre><code>node_modules\@reactivex\rxjs\dist\cjs\Observable.d.ts (10,66): Cannot find name 'Promise'. (2304)
  </code></pre>
  
  <p>I changed the target in <em>tsconfig.json</em> to <code>es6</code>.</p>