question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

1.5.2 Typescript scroll.d.ts possibly too strict

See original GitHub issue

Describe 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:closed
  • Created 4 years ago
  • Comments:14 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
outofmemoryagaincommented, Dec 2, 2019

@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 Element then the code will not work as is and will require as HTMLElement in order to use the offsetTop property. 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 as Element. 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.

0reactions
GordonBlahutcommented, Dec 13, 2019

That sounds fine to me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to suppress "error TS2533: Object is possibly 'null' or ' ...
This feature is called "strict null checks", to turn it off ensure that the ... so it is exciting to see languages such...
Read more >
Quasarians in Action #9. With Staff Pick of the Week!
Gordon Blahut reported the issue 1.5.2 Typescript scroll.d.ts possibly too strict which was fixed by a fix(typescript): revert scroll types ...
Read more >
Changelog
No longer includes .d.ts files when detecting TypeScript; Fixed #22034, ... While it's not strictly necessary for Cypress to parse your configuration, ...
Read more >
Underscore.js
Underscore is a JavaScript library that provides a whole mess of useful functional programming helpers without extending any built-in objects.
Read more >
April 2021 (version 1.56) - Visual Studio Code
This feature is based on a generic implementation in VS Code core and so may not be a perfect fit for all languages,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found