How to make web workers with TypeScript and webpack : <p>I'm having some issues with properly compiling my typescript when I attempt to use web workers. </p>

<p>I have a worker defined like this: </p>

<pre><code>onmessage = (event:MessageEvent) =&gt; {
  var files:FileList = event.data;
    for (var i = 0; i &lt; files.length; i++) {
        postMessage(files[i]);
    }
};
</code></pre>

<p>In another part of my application i'm using the webpack worker loader to load my worker like this: <code>let Worker = require('worker!../../../workers/uploader/main');</code></p>

<p>I'm however having some issues with making the typescript declarations not yell at me when the application has to be transpiled. 
According to my research i have to add another standard lib to my tsconfig file to expose the global variables the worker need access to. These i have specified like so: </p>

<pre><code>{
     "compilerOptions": {
          "lib": [
               "webworker",
               "es6",
               "dom"
          ]
     }
}
</code></pre>

<p>Now, when i run webpack to have it build everything i get a bunch of errors like these: <code>C:/Users/hanse/Documents/Frontend/node_modules/typescript/lib/lib.webworker.d.ts:1195:13
    Subsequent variable declarations must have the same type.  Variable 'navigator' must be of type 'Navigator', but here has type 'WorkerNavigator'.</code></p>

<p>So my question is: How do I specify so the webworker uses the lib.webworker.d.ts definitions and everything else follows the normal definitions?</p>
