Loading topic
/** ... */ comment placed directly above the code, with a description followed by tags. The type syntax inside the braces gets a f3 min read@param and @returns. Here we cover what goes inside the curly braces: the type expression.2 min read@param and @returns tags and read JSDoc type expressions such as string[], number | null, and { id: string }. It also assumes you know JavaScript objects and array methods like filter.2 min read@param and @returns tell a reader what goes in and what comes out. They do not show how to call a function, what can go wrong, where to read more, or whether the function should still be used. This chapter covers the five tags that carry that information: @example, @throws, `@3 min readimport and export. It also assumes you already know @param, @returns, and basic JSDoc type syntax from earlier chapters. Here you will apply those tags to classes, their members, and whole modules.2 min read@param and @returns tags, read JSDoc type expressions such as unions and arrays, and define types with @typedef. The examples show the types TypeScript-aware editors such as VS Code infer from JSDoc. Full type checking with // @ts-check gets its own chapter2 min read@typedef blocks, which earlier chapters covered. It also assumes you can run npm and npx and use an editor such as VS Code. The goal is to turn your JSDoc comments from documentation into types that a tool checks.2 min read@typedef and @callback definitions, that you understand ES module import and export, and that you have type checking turned on with // @ts-check or checkJs. Once a project has more than a few files, you will want to define a type such as2 min readjsdoc command-line tool can also turn those same comments into a browsable HTML site. This chapter covers installing the tool, running it, configuring it, and fixing the problems people hit most often.2 min readeslint-plugin-jsdoc is an ESLint plugin that reads your JSDoc blocks and reports problems such as missing tags, names that don't match the real parameters, 3 min read// @ts-check with checkJs, and the basic eslint-plugin-jsdoc setup. Here the question changes from how to write JSDoc to when to write it, and how to keep it true after the code changes.3 min read