Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Node.parentElement should be maybe-null #11113

Copy link
Copy link
@evmar

Description

@evmar
Issue body actions

lib.dom.ts defines Node.parentElement as never-null:
https://github.com/Microsoft/TypeScript/blob/95c3eccbe9f3f7e1857ce157d437e6b80b3c9c6f/lib/lib.dom.d.ts#L8749

However, it's a pretty common pattern to write loops like

while (n.parentElement != null) {
  // [...]
  n = n.parentElement;
}

to walk up the node tree.

Also parentNode, previousSibling, nextSibling, firstChild, lastChild... (?)

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Breaking ChangeWould introduce errors in existing codeWould introduce errors in existing codeBugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issueHelp WantedYou can do thisYou can do this

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.