Skip to content

Commit 9031d1d

Browse files
authored
Accept type argument to getElementById
This provides an alternative to the common pattern of `document.getElementById("...") as HTMLWhateverElement` which casts away the possibility of `null`, consequently hiding a potential type error.
1 parent a650695 commit 9031d1d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

inputfiles/overridingTypes.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@
654654
"getElementById": {
655655
"name": "getElementById",
656656
"overrideSignatures": [
657-
"getElementById(elementId: string): HTMLElement | null"
657+
"getElementById<T = HTMLElement>(elementId: string): T | null"
658658
]
659659
},
660660
"getElementsByTagNameNS": {

0 commit comments

Comments
 (0)