Typescript viewport event handler does not exist
See original GitHub issueHello, I’m trying to add an event handler to a viewport like so
const viewport = new Viewport().on("clicked", () => {});
But I’m getting the Typescript error Property 'on' does not exist on type 'Viewport'.
Is this method missing from the Viewport’s Typescript definition? Thanks!
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Cannot read property 'addEventListener' of null - Stack Overflow
I think the easiest approach would be to just check that el is not null before adding an event listener: var el =...
Read more >VisualViewport: scroll event - Web APIs - MDN Web Docs
The scroll event of the VisualViewport interface is fired when the visual viewport is scrolled.
Read more >Scroll Events and Intersection Observer - Beginner JavaScript
In this video we will learn about scroll events. A scroll event is when someone goes ahead and scrolls on the page or...
Read more >ResizeObserver: it's like document.onresize for elements
ResizeObserver notifies you when an element's content rectangle changes size so that you can react accordingly.
Read more >mouseup and mousedown event types missing? #289 - GitHub
Edit: Hmm, maybe I'm mistaken here. I tried downgrading again but the errors are still there. Might be the fact that I upgraded...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ahh ok so the project was on an older version. It’s now fixed after upgrading from
v5.3.3
->v6.2.0
. Thanks so much for the help!Turns out the problem was not having
"esModuleInterop": true
in my tsconfig.json file. Adding that fixed the type error.