title: TypeScript typings give me "index.d.ts is not a module"
body: <p>I am getting <em>File node_modules/@types/webrtc/index.d.ts is not a module</em> with this code:</p>
  
  <pre><code>import * as webrtc from "webrtc";
  const peerConnection1 = new RTCPeerConnection();
  </code></pre>
  
  <p>I have installed the typings using <code>npm i @types/webrtc --save-dev</code>. Hovering over <code>RTCPeerConnection</code> in <code>const peerConnection1 = new RTCPeerConnection();</code> display type annotations in Visual Studio Code so at least the code editor sees the types. Running <code>tsc</code> (or <code>webpack</code> with <code>ts-loader</code>) fails with the error.</p>
  
  <p>I have tried <code>npm i webrtc --save</code> in a misguided attempt for solving this, but it did not change anything and I really only want the typings anyway, WebRTC is right there in the browser, I don't need a package for that. (Support aside.)</p>
  
  <p>The <code>index.d.ts</code> file indeed is not a module, it just references two other files with interfaces in them. So I thought to remove <code>import * as webrtc from "webrtc";</code> hoping the typings will still be visible by <code>tsc</code> somehow. (But that's impossible since I exclude <code>node_modules</code> in TypeScript config file.) When I do that <code>RTCPeerConnection</code> is no longer recognized.</p>
  
  <p>Adding <code>/// &lt;reference src="node_modules/@types/webrtc/" /&gt;</code> did not help, <code>tsc</code> says <em>Invalid reference directive syntax</em>.</p>
  
  <p>You can view a repository with minimal repro <a href="https://gitlab.com/TomasHubelbauer/qr-signalling-channel" rel="noreferrer">here on GitLab</a>. I am not too well versed in TypeScript typings acquisition so please forgive my ignorance if I'm going about this all wrong.</p>