ResizeObserver not present on the Window interface

Open
#1,683 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
52/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
typescript
Domain
tooling

Research direction

Start by tracing the generator inputs and generated DOM declarations for ResizeObserver and Window. Verify how the Window interface is represented, then run the repository's relevant generation or type-checking checks; done means popup.ResizeObserver typechecks while the global declaration remains available.

Written by the indexing model from the issue text.

Description

The ResizeObserver class is only available as a global declaration and not on the Window interface. I think it should also be available on the Window interface for at least two reasons:

  • The specification (https://drafts.csswg.org/resize-observer/#idl-index) says [Exposed=(Window)], which I’m guessing means that it is supposed to be on the Window interface (I’m actually surprised, isn’t the specification supposed to be automatically translated to Typescript declarations?)
  • For applications with several windows, it behaves differently depending on the window from which it is taken (see https://codepen.io/Latcarf/pen/RwdyLXr?editors=0010). So it would make a lot of sense to be able to do the following, which currently doesn’t typecheck as popup is of type Window.
const popup = window.open(...)!;
new popup.ResizeObserver(...);
Dominant language
TypeScript
Stars
740
Forks
474
Avg merge
2d 8h
Merged PRs (30d)
15

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/TypeScript-DOM-lib-generator

All issues in microsoft/TypeScript-DOM-lib-generator

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.