Search code examples
c#typescriptdocumentationcommentsconventions

Typescript: Are there any conventions to document code with comments?


I am used to document code in our C# projects in a specific way to enhance team productivity, benefit from Intellisense in Visual Studio etc.

Code looks similar to this:

/// <summary>
/// Loads a user with a specific id.
/// </summary>
/// <param name="id">The id of the user to search for.</param>
/// <returns>A user with the given id.</returns>
public User GetUserById(string id) {
    ...
}

Are there any similar conventions for Typescript for commenting and documentation? Or even tools that use these conventions to generate documentation pages in html from code comments (like JavaDoc)?


Solution

  • Yes there are.

    Most common used comment conventions (to no surprise) comes from javascript in form of jsdoc. For example VSCode support them out of the box. Also there are some tools specifically developed for typescript doc generation like typedoc