title: How to use Typescript DOM lib on the server?
body: <p>I am writing code for a Google cloud function. Here I want to use the URL standard including <code>URLSearchParams</code>. I found out that they are part of the TypeScript DOM lib, so I've added that to my tsconfig <code>lib</code> setting.</p>
  <p>However, when I compile and deploy the cloud function I get a runtime error saying URLSearchParams is not defined.</p>
  <p>What am I missing? I'm using TS 2.6</p>
  <hr />
  <p>Here is my config:</p>
  <pre><code>{
    &quot;compilerOptions&quot;: {
      /* Basic Options */
      &quot;target&quot;: &quot;es6&quot;,
      &quot;module&quot;: &quot;commonjs&quot;,
      &quot;lib&quot;: [&quot;es6&quot;, &quot;es7&quot;, &quot;esnext&quot;, &quot;dom&quot;],
  
      &quot;sourceMap&quot;: true /* Generates corresponding '.map' file. */,
      &quot;outDir&quot;: &quot;build&quot; /* Redirect output structure to the directory. */,
      &quot;removeComments&quot;: true /* Do not emit comments to output. */,
  
      /* Strict Type-Checking Options */
      &quot;strict&quot;: true /* Enable all strict type-checking options. */,
  
      /* Additional Checks */
      &quot;noUnusedLocals&quot;: true /* Report errors on unused locals. */,
      &quot;noUnusedParameters&quot;: true /* Report errors on unused parameters. */,
      &quot;noImplicitReturns&quot;: true /* Report error when not all code paths in function return a value. */,
      &quot;noFallthroughCasesInSwitch&quot;: true /* Report errors for fallthrough cases in switch statement. */,
  
      &quot;plugins&quot;: [{ &quot;name&quot;: &quot;tslint-language-service&quot; }],
      &quot;skipLibCheck&quot;: false
    },
    &quot;include&quot;: [&quot;src/**/*&quot;],
    &quot;exclude&quot;: [&quot;build&quot;]
  }
  </code></pre>
  <p>And package.json dependencies:</p>
  <pre><code>  &quot;dependencies&quot;: {
      &quot;circular-json&quot;: &quot;^0.4.0&quot;,
      &quot;es6-promisify&quot;: &quot;^5.0.0&quot;,
      &quot;firebase-admin&quot;: &quot;^5.5.0&quot;,
      &quot;firebase-functions&quot;: &quot;^0.7.3&quot;,
      &quot;invariant&quot;: &quot;^2.2.2&quot;,
      &quot;joi&quot;: &quot;12&quot;,
      &quot;lodash&quot;: &quot;^4.17.4&quot;,
      &quot;node-fetch&quot;: &quot;^2.0.0-alpha.9&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;@types/circular-json&quot;: &quot;^0.4.0&quot;,
      &quot;@types/invariant&quot;: &quot;^2.2.29&quot;,
      &quot;@types/joi&quot;: &quot;^13.0.0&quot;,
      &quot;@types/lodash&quot;: &quot;^4.14.85&quot;,
      &quot;@types/node&quot;: &quot;^8.0.52&quot;,
      &quot;@types/node-fetch&quot;: &quot;^1.6.7&quot;,
      &quot;cpy-cli&quot;: &quot;^1.0.1&quot;,
      &quot;del-cli&quot;: &quot;^1.1.0&quot;,
      &quot;firebase-tools&quot;: &quot;^3.15.1&quot;,
      &quot;tslint&quot;: &quot;^5.8.0&quot;,
      &quot;tslint-config-prettier&quot;: &quot;^1.6.0&quot;,
      &quot;tslint-language-service&quot;: &quot;^0.9.6&quot;,
      &quot;typescript&quot;: &quot;2.6&quot;
    }
  </code></pre>