title: TypeScript - use correct version of setTimeout (node vs window)
body: <p>I am working on upgrading some old TypeScript code to use the latest compiler version, and I'm having trouble with a call to <code>setTimeout</code>.  The code expects to call the browser's <code>setTimeout</code> function which returns a number:</p>
  
  <p><code>setTimeout(handler: (...args: any[]) => void, timeout: number): number;</code></p>
  
  <p>However, the compiler is resolving this to the node implementation instead, which returns a NodeJS.Timer:</p>
  
  <p><code> setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer;</code></p>
  
  <p>This code does not run in node, but the node typings are getting pulled in as a dependency to something else (not sure what).</p>
  
  <p>How can I instruct the compiler to pick the version of <code>setTimeout</code> that I want?</p>
  
  <p>Here is the code in question:</p>
  
  <pre><code>let n: number;
  n = setTimeout(function () { /* snip */  }, 500);
  </code></pre>
  
  <p>This produces the compiler error: <blockquote>TS2322: Type 'Timer' is not assignable to type 'number'.</blockquote></p>