1.5.2 Typescript scroll.d.ts possibly too strict
See original GitHub issueDescribe the bug RE #5725, the changes to scroll.d.ts may be overly strict. Pinging @IlCallo for feedback.
I ran into a build issue with setScrollPosition after upgrading to 1.5.2. The scrollTarget type was changed from Element | Window to HTMLElement | Window.
Element has scrollTop, scrollLeft, scrollHeight, and scrollWidth so it should be compatible with the implementation of the various scroll methods already.
Requiring HTMLElement kills support for calling scroll methods on $el of a Vue component, since Vue defines $el as Element.
I’m not sure what is gained by restricting the type to HTMLElement in these cases?
Codepen/jsFiddle/Codesandbox (required) N/A
To Reproduce Steps to reproduce the behavior: N/A
Expected behavior N/A
Additional context N/A
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (11 by maintainers)

Top Related StackOverflow Question
@IlCallo @rstoenescu, I think this request was initiated based on my use of the utility to scroll to a specific element as highlighted in the documention, https://quasar.dev/quasar-utils/scrolling-utils#Scrolling-to-an-element. If the return is
Elementthen the code will not work as is and will requireas HTMLElementin order to use theoffsetTopproperty. I made a bad assumption based on the example of the intended type. Based on the implementation the the scroll utility the type was correct asElement. This is simply a case that highlights the need for some specific TS based examples in the documentation. This is of course a longer term goal to improve our TS support.That sounds fine to me.