JSDoc tag

@description and @summary

  • Documentation only
  • Tested with TypeScript 5.9
  • Alias @desc

The description of a function is the text at the top of its JSDoc comment, before the first tag. Editors show it under the signature when you hover the name or type a call. TypeScript treats it as documentation only: nothing in it is checked.

@description (also @desc) and @summary are JSDoc documentation tags for the same purpose. TypeScript 5.9 keeps them as ordinary tags: the hover shows them after the signature as @description and @summary lines, not as the main text. For TypeScript users, plain text at the top of the comment works best.

At a glance

Use JSDoc in a .js file TypeScript in a .ts file
The main description /** * Works out the shipping charge. * @param {number} subtotal */ /** * Works out the shipping charge. * @param subtotal */
A one-line summary /** @summary Shipping charge for a cart. */ /** @summary Shipping charge for a cart. */

Examples

shipping.js TypeScript 5.9.3 TypeScript 5.9.3, run 21 October 2026: No errors. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. No errors. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. No errors. checked 21 October 2026
/**
 * Works out the shipping charge for a cart, in dollars.
 *
 * Orders over $50 ship free.
 *
 * @summary Shipping charge for a cart.
 * @param {number} subtotal
 * @returns {number}
 */
export function shippingFor(subtotal) {
  return subtotal > 50 ? 0 : 4.95;
}

// In the hover, this text appears as a tag below the signature, not as the main description.
/**
 * @description Works out the tax for a cart.
 * @param {number} subtotal
 * @returns {number}
 */
export function taxFor(subtotal) {
  return Math.round(subtotal * 0.08 * 100) / 100;
}

shippingFor(42);
taxFor(42);
The text before the first tag is the description.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "target": "es2022",
    "module": "nodenext",
    "types": []
  },
  "include": ["*.js"]
}
shipping.js TypeScript 5.9.3 TypeScript 5.9.3, run 21 October 2026: No errors. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. No errors. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. No errors. checked 21 October 2026
/**
 * Works out the shipping charge from `subtotl` (misspelled on purpose:
 * TypeScript does not check names in the description).
 *
 * @param {number} subtotal
 * @returns {number}
 */
export function shippingFor(subtotal) {
  return subtotal > 50 ? 0 : 4.95;
}
Descriptions are text: a wrong name in one is not an error.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "target": "es2022",
    "module": "nodenext",
    "types": []
  },
  "include": ["*.js"]
}

What editors show

We asked TypeScript's language service, the code editors call for hovers, about both functions in the first example. For shippingFor, the documentation is the text above the tags, and @summary comes back as a separate tag. For taxFor, whose comment starts with @description, the main documentation is empty and the text comes back as a tag named description.

Descriptions can use Markdown in most editors, and {@link} turns a name into a link to its declaration.

Gotchas

  • Names and types in the description are not checked: a misspelled parameter name in the text stays misspelled, as the second example shows. Only the tags with types (@param, @returns, @type and the rest) are read by the checker.
  • An @ followed by a word starts a new tag, even in the middle of a sentence. Put such text in backticks or reword it.

Questions

Do I need @description in a TypeScript project?

No. Write the description as the first lines of the comment. Keep @description only if a documentation tool you use requires it.

Sources

Last reviewed 20 October 2026.