JSDoc

JSDoc is a documentation generator for JavaScript that follows the Javadoc model: developers annotate their code with specially formatted comments, and the tool processes those comments into formatted HTML API documentation. The project’s site presents it as a way to add structured documentation directly within source files, keeping the description of an interface next to the code that implements it.

The annotations are organized as tags. Block tags carry the bulk of the documentation: @param describes a function parameter, @returns describes its result, @type and @typedef declare types, and tags such as @class, @function, @module, @property, and @member describe the shape of the code. Access modifiers like @private, @public, @protected, and @package express visibility, while metadata tags including @author, @version, @deprecated, and @license record provenance. Inline tags such as @link and @tutorial embed cross-references and pointers to longer material within descriptions. JSDoc understands the various JavaScript module systems, including ES2015 classes and modules, CommonJS, and AMD.

What distinguishes JSDoc from earlier comment-based generators is its second life as a type-annotation system. Because JavaScript is dynamically typed, JSDoc’s @param, @returns, and @type tags became a practical way to declare types without changing the language. Editors and language servers read these annotations to provide autocompletion, inline documentation, and inline error checking, so the same comments that produce reference docs also improve the day-to-day coding experience.

That overlap connects JSDoc directly to TypeScript. The TypeScript compiler can type-check plain JavaScript using JSDoc annotations, letting projects gain type safety while staying in JavaScript files. As a result, many codebases use JSDoc comments primarily for their tooling value, with HTML documentation as a secondary output. The tool is maintained openly on GitHub under the jsdoc organization.

JSDoc thus carries the in-source documentation culture of Javadoc and Doxygen into the JavaScript ecosystem, and extends it. By making annotated comments serve both as published documentation and as machine-readable type information, it fits the docs-as-code pattern of treating documentation as a build product that lives in version control alongside the code.

Sources

Last verified June 8, 2026