10000 IntersectionObserverInit.root should accept type Document · Issue #40454 · microsoft/TypeScript · GitHub
[go: up one dir, main page]

Skip to content
IntersectionObserverInit.root should accept type Document #40454
@troyt-42

Description

@troyt-42

According to https://w3c.github.io/IntersectionObserver/#dictdef-intersectionobserverinit, the IntersectionObserverInit.root should be of type Document | Element | null instead of just Element | null (https://github.com/microsoft/TypeScript/blob/v4.0.2/lib/lib.dom.d.ts#L638)

TypeScript Version: 4.0.2

Search Terms:
Intersection Observer, IntersectionObserverInit
Code

      const intersectionObserver = new IntersectionObserver(
        () => {},
        {
          root: document,
        }
      );

Expected behavior:
No error should be raised
Actual behavior:
See error:

TS2740: Type 'Document' is missing the following properties from type 'Element': assignedSlot, attributes, classList, className, and 58 more.

Playground Link:

Related Issues:

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

      0