`window.parent` should be nullable
yohabe opened this issue · comments
⚙ Compilation target
es2017
⚙ Library
ESNext
Missing / Incorrect Definition
In the whatwg definition, window.parent
is nullable. whatwg/html#2123
The definition of window.parent
in this repository is not nullable.
readonly parent: WindowProxy;
BTW, the definition of window.top is nullable, which is inconsistent.
readonly top: WindowProxy | null;
Sample Code
readonly parent: WindowProxy;
Documentation Link
https://html.spec.whatwg.org/multipage/nav-history-apis.html#the-window-object
@whzx5byb
Thank you for your response.
Wouldn't it be better for consistency to make window.top non-nullable?
Which one is this bug about?
There are three options.
Option 1: Comply with WHATWG by making window.parent
nullable.
Option 2: Given that window.parent
is non-nullable as TypeScript's specification, make window.top
also non-nullable for consistency.
Option 3: Leave it as is, meaning window.parent
is non-nullable and window.top
is nullable. The inconsistency is attributed to TypeScript's specification.
Without a stronger argument for any one of those, we'll leave as-is. Thanks!
What is the reason for creating a situation that contradicts the WHATWG specifications and lacks consistency with the definition of window.top?