title: Modify global with an interface that may or may not be there
body: <p>I'm sharing some code between the browser and node and I'd like to use <code>performance.now()</code> instead of <code>Date.now()</code> if available. Unfortunately, in node, <code>performance</code> is not available and typescript gives me an error. I could add the entire <code>dom</code> library, but that pulls in everything, which I'd like to avoid because it would certainly eventually mask real errors. So, how can I modify the global namespace to say: "hey, there's this name <code>performance</code> that may or may not exist"</p>
  
  <p>For what it's worth, this is the line that I'm trying to get to compile cleanly in node and the browser:</p>
  
  <pre><code>const lastUpdate = typeof performance !== undefined ? performance.now() : Date.now();
  </code></pre>
  
  <p>and this is the error I get:</p>
  
  <blockquote>
    <p>error TS2304: Cannot find name 'performance'.</p>
  </blockquote>