Skip to content

Declare Document.scrollingElement as HTMLElement | null - #64342

Draft
Ryan Cavanaugh (RyanCavanaugh) with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-inconsistent-types-scrollingelement
Draft

Ryan Cavanaugh (RyanCavanaugh) with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-inconsistent-types-scrollingelement

Conversation

Copilot AI commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Document.scrollingElement was declared Element | null while documentElement and body — the only two values it can return per CSSOM View — are both declared HTMLElement.

// Previously TS2322; now assignable.
const element: HTMLElement | null = document.scrollingElement;

Changes

  • lib.dom.d.ts: readonly scrollingElement: HTMLElement | null;
  • New compiler test documentScrollingElementType.ts covering assignability to HTMLElement | null.
  • Baseline update for mappedTypeRecursiveInference.types, which structurally expands Document.

Note

lib.dom.d.ts is generated; a corresponding change in TypeScript-DOM-lib-generator is needed so this survives the next regeneration.

@typescript-automation typescript-automation Bot added For Milestone Bug PRs that fix a bug with a specific milestone labels Sep 19, 2026
@typescript-automation typescript-automation Bot added For Uncommitted Bug PR for untriaged, rejected, closed or missing bug and removed For Milestone Bug PRs that fix a bug with a specific milestone labels Sep 19, 2026
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix inconsistent types between Document scrollingElement and documentElement Declare Document.scrollingElement as HTMLElement | null Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent types between Document scrollingElement and documentElement

2 participants