title: Type 'HTMLDivElement | null' is not assignable to type 'HTMLDivElement'
body: <p>I'm working on this scroll function to lock the position while scrolling up or down
  and I have encountered below error</p>
  <pre><code>Type 'HTMLDivElement | null' is not assignable to type 'HTMLDivElement'.
  Type 'null' is not assignable to type 'HTMLDivElement'.ts(2322)
  </code></pre>
  <p>Could anyone help me resolving this error?</p>
  <pre><code>scroll = (): void =&gt; {
    if (this.isLargerScreenMedia()) {
      this.applyLargeMediaStyles();
    } else {
      const scrollPos: number = document.documentElement.scrollTop;
      const totalCon: HTMLDivElement =
        this.tripTotalContainer.querySelector('.trip-total-module');
      if (totalCon) {
        if (scrollPos &gt; this.lastScrollPos) {
          //scroll down
          totalCon.style.bottom = '0px';
        } else {
          //scroll up
          totalCon.style.bottom = '27px';
        }
      }
      this.lastScrollPos = scrollPos &lt; 0 ? 0 : scrollPos;
      this.tripTotalContainer.classList.add('sticky-bottom');
    }
  };
  </code></pre>