HaxeFoundation / HaxeFoundation/haxe

js.html.Document.getElementById method should take into account null values

Open
#10,131 0 comments 1 reaction 1 assignee Claimed by @haxiomic View on GitHub
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

## Description

The signature of the method [`js.html.Document.getElementById()`](https://api.haxe.org/v/3.4.7/js/html/Document.html#getElementById) does not match the documentation of the return type mentioned in the MDN documentation of [`getElementById()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById#return_value).

This is the Haxe signature for this method:

```haxe
getElementById(elementId: String): Element
```

This is the deducted MDN signature :

```typescript
getElementById(id: string): Element|null
```

## Expected behavior

The signature takes into account nullable values

```haxe
getElementById(elementId: String): Null
```

Such that the compiler can warn null access if the `@:nullSafety()` macro is used.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.