We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node.parentElement has type HTMLElement | null but it should be Element | null
HTMLElement | null
Element | null
Expected: node.parentElement type to be Element | null Actual: HTMLElement | null
node.parentElement
https://www.typescriptlang.org/play/?#code/MYewdgzgLgBKZQIYEswFMBOMC8MAmIwArgLZoIB0wGaiUaAogDZpkIAUA5HsgG6cBKAFDwkqTBVToMACQAqAWQAyOGJwA8EXgHMAfOr3qA9IaNa9nISPDQY21aJTSKAM2QZozVuSgBhABbITHgAhK7unixsfoHBMIgQMADKAGoA4mle0VbwECAsFEwg2uzaFAAOiDQIWT4wqNCIYMBoIC7J6bUIAjBGRjBQGERoMDk2sNoATKplldVQXbAJHZlRPmOQ+WiFxaXTDUjNre2pq97dvf2ITHkDQ2hCQA
@types/web
Proof: run the example in the playground.
Similar to:
getElementById()
The text was updated successfully, but these errors were encountered:
Typescript does not want to be precise but also usable. Having errors on code like this would be annoying, too
const div = document.createElement('div') console.log(div.parentElement?.style.display)
Sorry, something went wrong.
Also dupe of #1706 (which is again dupe of #1151)
(which is again dupe of #1151)
which was opened by .... trusktr himself :-)
No branches or pull requests
Summary
Node.parentElement has type
HTMLElement | null
but it should beElement | null
Expected vs. Actual Behavior
Expected:
node.parentElement
type to beElement | null
Actual:
HTMLElement | null
Playground Link
https://www.typescriptlang.org/play/?#code/MYewdgzgLgBKZQIYEswFMBOMC8MAmIwArgLZoIB0wGaiUaAogDZpkIAUA5HsgG6cBKAFDwkqTBVToMACQAqAWQAyOGJwA8EXgHMAfOr3qA9IaNa9nISPDQY21aJTSKAM2QZozVuSgBhABbITHgAhK7unixsfoHBMIgQMADKAGoA4mle0VbwECAsFEwg2uzaFAAOiDQIWT4wqNCIYMBoIC7J6bUIAjBGRjBQGERoMDk2sNoATKplldVQXbAJHZlRPmOQ+WiFxaXTDUjNre2pq97dvf2ITHkDQ2hCQA
Browser Support
Have Tried The Latest Releases
@types/web
.Additional Context
Proof: run the example in the playground.
Similar to:
getElementById()
#2020The text was updated successfully, but these errors were encountered: