Skip to content

DOM lib is missing Intersection Observer API on window global #16255

Closed

Description

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.

Activity

  1. added this to the milestone on Jun 6, 2017
  2. mhegazy commented on Jun 6, 2017

    @mhegazy
    Contributor

    PRs welcomed. You can find more information about contributing lib.d.ts fixes at https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md#contributing-libdts-fixes.

  3. remojansen commented on Jun 14, 2017

    @remojansen
    Contributor

    Can this issue be closed? Looks like the change has already been merged into master?

  4. OliverJAsh commented on Jun 14, 2017

    @OliverJAsh
    ContributorAuthor

    Aha, looks like they are in the typings, just not exposed on the window interface:

    new IntersectionObserver(() => {}); // no error
    window.IntersectionObserver // error: Property 'IntersectionObserver' does not exist on type 'Window'.
  5. changed the title [-]DOM lib is missing Intersection Observer API[/-] [+]DOM lib is missing Intersection Observer API on window global[/+] on Jun 14, 2017
  6. added a commit that references this issue on Aug 29, 2017
    6813a0b
  7. Hiswe commented on Nov 8, 2018

    @Hiswe

    As a temporary fix

    export {}
    declare global {
      interface Window {
        IntersectionObserver: typeof IntersectionObserver
      }
    }
  8. felipedrumond commented on Dec 19, 2020

    @felipedrumond

    IntersectionObserverEntry lacks isVisible property.
    Chrome Version 87.0.4280.88

    image

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

  9. Andarist commented on Feb 12, 2023

    @Andarist
    Contributor

    This has been added in 3.6, the issue can be closed

  10. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions