title: Typescript - Property 'scrollY' does not exist on type 'HTMLElement'
body: <p>I got this method:</p>
  
  <pre><code>class Foo {
      private getDistanceFromTop (el: HTMLElement): number {
          return el.scrollY || el.scrollTop;
      }
  }
  </code></pre>
  
  <p>The <code>el</code> argument is dynamic and can be an <code>HTMLElement</code> or an <code>window</code> object. I tried to convert it to <code>Window</code> type using <code>as</code>, but another compilation error appears: <code>Type 'HTMLElement' cannot be converted to type 'Window'</code>.  So how do I modify this code in order to make it pass TS validation and without using the <code>:any</code> type?</p>