title: Type error: Object is possibly 'null'. TS2531 for window.document
body: <p>I am adding TypeScript to my project for the first time.</p>
  <p>Using <code>window.document.getElementById()</code> to access something results in the error:</p>
  <pre class="lang-bash prettyprint-override"><code>Type error: Object is possibly 'null'.  TS2531
  </code></pre>
  <p>I searched online but couldn't come to the best solution for this. <code>window</code> can never be null.</p>