microsoft / microsoft/TypeScript
incorrect return type of NodeListOf.item()
Open
Nobody has claimed this yet.
Awaiting More Feedback
Suggestion
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
typescript version: 3.9.2
method item() of nodelist should return a node or null (if index out of range)
(see: https://developer.mozilla.org/en-US/docs/Web/API/NodeList/item)
Typescript behavior is incorrect (lib.dom.d.ts)
interface NodeListOf<TNode extends Node> extends NodeList {
item(index: number): TNode;
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib.dom.d.ts by inspecting the NodeListOf declaration and its item() return type. Confirm the DOM specification and MDN behavior, then update the declaration so an out-of-range item is represented correctly; done means the generated DOM typings match that behavior and relevant TypeScript checks pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100