microsoft / microsoft/TypeScript

`ReadonlyMap` lacks documentation for `forEach`, `get`, `has` and `size`

Open Beginner friendly
#63,710 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Domain: lib.d.ts Possible Improvement
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

### ⚙ Compilation target

ES2015+

### ⚙ Library

lib.es2015.collection.d.ts

### Missing / Incorrect Definition

`ReadonlyMap` lacks documentation for `forEach`, `get`, `has` and `size`.

Hovering these members in an editor shows no description, unlike the corresponding members of `Map`. The documentation should ideally be copied from regular `Map` for consistency, exactly as was done for `ReadonlySet` in #63481 (fixed by #63483).

Note: the `ReadonlyMap` members declared in lib.es2015.iterable.d.ts (`entries`, `keys`, `values` and `[Symbol.iterator]`) are already documented; only the four members declared in lib.es2015.collection.d.ts lack documentation.

### Sample Code

```ts
declare const m: ReadonlyMap;

// Hover any of these: no documentation is shown
m.get("a");
m.has("a");
m.size;
m.forEach(v => console.log(v));
```

### Documentation Link

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open lib.es2015.collection.d.ts and compare the documented members of Map with forEach, get, has and size on ReadonlyMap. Check the ReadonlySet documentation change from #63481/#63483 for consistency. Done means editor hovers show descriptions for all four ReadonlyMap members matching the corresponding Map documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
90/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.