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:
According to https://w3c.github.io/IntersectionObserver/#dictdef-intersectionobserverinit, the IntersectionObserverInit.root should be of type
Document | Element | nullinstead of justElement | 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
Expected behavior:
No error should be raised
Actual behavior:
See error:
Playground Link:
Related Issues: