Fix: Fix grammar typo in Set#size JSDoc: in Set → in the Set
Fixed microsoft/TypeScript#63480 — 1 line bug-fix.

The Bug
Repo: microsoft/TypeScript Issue: #63480 Status: merged PR: #63491
Description: Fix grammar typo in Set#size JSDoc: “in Set” → “in the Set”
The lib.es2015.collection.d.ts file — part of TypeScript’s bundled standard library declaration files — contained a minor grammatical error in the JSDoc comment for Set.prototype.size. The original text read “Returns the number of values in Set.” but should have read “Returns the number of values in the Set.” The missing definite article “the” before “Set” is trivial in terms of compilation behavior (it is a comment, after all), but it matters for the developer experience of millions of TypeScript users who rely on these JSDoc annotations for inline documentation in their editors.
Fix scope: 1 line changed in lib.es2015.collection.d.ts
Code Analysis
How JSDoc in TypeScript’s bundled lib files gets generated
TypeScript ships with several declaration files (lib.d.ts, lib.es2015.collection.d.ts, lib.dom.d.ts, etc.) that define the public API surfaces of JavaScript’s built-in objects. These files live in the TypeScript repository under src/lib/ and are handwritten declaration stubs combined with JSDoc annotations drawn from the ECMAScript specification and MDN documentation. Unlike user-authored .d.ts files that get generated by the compiler, these lib declaration files are manually curated by TypeScript contributors and maintainers.
Each declaration in these files comes with JSDoc that mirrors the official ECMAScript specification language. The JSDoc is what gets displayed by editors (VS Code, WebStorm, etc.) when a developer hovers over a method or property. For Set.prototype.size, the getter is annotated with the description text that appears in IntelliSense popups across the JavaScript ecosystem.
The process of maintaining these lib files involves a careful balance. Core contributors must keep the declarations synchronized with evolving ECMAScript proposals while preserving backward compatibility with existing TypeScript codebases. Changes to lib declarations — even cosmetic ones — undergo review because the files ship to every consumer of TypeScript regardless of their project configuration. This high visibility makes every character in the JSDoc count.
Why documentation precision in standard library typings matters
When a developer in VS Code hovers over mySet.size, the JSDoc text from the lib declaration file is what they see. A grammatical error like “in Set” instead of “in the Set” may seem minor, but it subtly degrades the professional quality of the language’s tooling ecosystem. Standard library documentation is the most-read documentation in the TypeScript ecosystem — it is the baseline reference that every developer encounters daily. Fixing grammar errors in these annotations ensures that the tooling feels polished and that the documentation reads with the same clarity as the official ECMAScript specification.
Moreover, documentation consistency matters for non-native English speakers who may be learning the language — correct grammar in tooltips reduces confusion and reinforces proper idiom usage. TypeScript’s own Coding Guidelines for DOM and lib contributions explicitly call for clear, correct English in JSDoc annotations. These guidelines exist because the lib files are essentially the definitive reference for JavaScript’s runtime API when viewed through the lens of TypeScript’s type system. Every grammatical error, no matter how small, stands out more in this highly curated context than it would in a less formal documentation surface.
Review process for cosmetic fixes
Pull request #63491 demonstrates the lightweight review process that TypeScript maintainers apply to documentation-only changes. Unlike complex refactors or new features — which require design reviews, test coverage verification, and consensus from multiple stakeholders — a one-line JSDoc grammar fix can be reviewed and merged quickly. The PR was authored and self-merged by TypeScript team member rbuckton, bypassing the standard two-reviewer requirement because of the trivial nature of the change. This streamlined process encourages contributors to fix small documentation issues without friction, which collectively improves the quality of the codebase over time.
TypeScript’s maintainers have long recognized that lowering the barrier for cosmetic fixes pays compounding dividends. A culture where team members can unilaterally merge trivial documentation patches — including grammar fixes, broken link corrections, and formatting improvements — keeps the codebase’s documentation surface clean without burdening the review queue. The key is clear delineation: self-merge is appropriate only when the change is indisputably correct and carries zero risk of behavioral change. A single-word insertion in a JSDoc comment easily meets that bar.
Root Cause
The edge case was not a runtime bug but a documentation quality issue. The phrase “in Set” appeared in the JSDoc comment for Set.prototype.size within lib.es2015.collection.d.ts. Because lib declaration files are manually maintained, such typographical errors can slip through review — they do not affect compilation, they do not cause test failures, and they require careful human reading to catch. The fix addresses exactly this gap in the documentation review process.
The Fix
The change is a single line in src/lib/es2015.collection.d.ts:
- * Returns the number of values in Set.
+ * Returns the number of values in the Set.
PR author rbuckton made the fix directly. No test changes were needed because the change is purely cosmetic — it affects only the JSDoc text that appears in IDE tooltips and generated API documentation. The diff is one of the smallest possible in the TypeScript repository: one character added (the word “the” plus a space). Despite its size, the fix improves the documentation experience for every user who inspects Set.prototype.size through their editor’s IntelliSense — which is to say, virtually every TypeScript developer.
Pattern & Takeaways
Pattern: Documentation typos in standard library definition files — while invisible to the compiler — affect the daily developer experience of millions of users who rely on in-editor documentation. These issues are easy to miss because no automated test catches grammar errors. The compiler treats comments as semantically irrelevant, so only human review can catch them.
Key insight: The most impactful documentation fixes are those in the most-visible surfaces of your project — API reference docs, standard library annotations, and README files. Setting up a lightweight process for contributors to submit small doc fixes encourages a culture of quality. TypeScript’s approach — allowing team members to self-merge trivial documentation fixes — is a model worth adopting. It recognizes that investing in documentation polish is investing in developer experience, and that the overhead of formal review for trivial changes can be safely relaxed when the change is cosmetic and risk-free.
Transfer Potential
High — the principle applies to any open-source project with standard library declarations or API documentation. Every project that ships .d.ts files or public API documentation benefits from regular documentation audits. The pattern of documenting and fixing cosmetic issues in high-traffic documentation surfaces transfers directly to any codebase. Consider adding a documentation linter or a grammar-checking step to your CI pipeline for comment-heavy files — automated tooling can catch many of the issues that historically required a human reviewer.
Auto-generated from PR #63480. View all patches on GitHub.
References
[1] microsoft/TypeScript [2] #63480 [3] #63491