1 Documenting JavaScript
Joshua Smithrud редактировал(а) эту страницу 2022-07-13 16:09:08 -07:00

Unless otherwise indicated, our TypeScript Documentation Guidelines should be followed for JavaScript code. This helps encourage consistency across our repo, and also alleviates the need for developers to remember 2 different sets of documentation syntax.

This includes the set of tags supported by TSDoc. Unless there is a real need to do so, tags should be limited to those supported by TSDoc.

Exceptions

Notable exceptions to the above statement include:

Parameter Types

In TypeScript, we don't explicitly document parameter types, since the type-system encapsulates that information. In JavaScript, we don't have that luxury, so we encourage adding the type information to parameter docs.

Parameter Types Example

/**
 * Adds 2 numbers together
 * @param {number} a - One of the numbers being added
 * @param {number} b - One of the numbers being added
 */
const add = (a, b) => {
    ...
};