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.

DOM lib is missing Intersection Observer API on window global

See original GitHub issue

TypeScript Version: 2.3.4

Code

The browser Intersection Observer API defines these on the window:

window.IntersectionObserver
window.IntersectionObserverEntry

Expected behavior: These should be defined in the DOM lib typings.

Actual behavior: They are not defined, so I get type errors.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
Hiswecommented, Nov 8, 2018

As a temporary fix

export {}
declare global {
  interface Window {
    IntersectionObserver: typeof IntersectionObserver
  }
}

0reactions
felipedrumondcommented, Dec 19, 2020

IntersectionObserverEntry lacks isVisible property. Chrome Version 87.0.4280.88

image

Edit: after a quick test, this isVisible seems to be always false.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DOM lib is missing Intersection Observer API on window global
TypeScript Version: 2.3.4 Code The browser Intersection Observer API defines these on the window: window.IntersectionObserver window.
Read more >
Intersection Observer API - MDN Web Docs
Consider a web page that uses infinite scrolling. It uses a vendor-provided library to manage the advertisements placed periodically throughout ...
Read more >
intersection-observer - npm
This library polyfills the native IntersectionObserver API in unsupporting browsers. See the API documentation for usage information.
Read more >
Mock for intersection observer in jest and typescript
A simple implementation would be: window.IntersectionObserver = jest.fn(() => ({ takeRecords: jest.fn ...
Read more >
Intersection Observer API - David Walsh Blog
It's because of this that so many of the recent development efforts have been focused around rendering, with virtual DOM being one of...
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