Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Docstring format for TypeScript #68

Open
ColinLefter opened this issue Mar 1, 2024 · 1 comment
Open

Docstring format for TypeScript #68

ColinLefter opened this issue Mar 1, 2024 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@ColinLefter
Copy link
Owner

Please refer to the following format when writing function docstrings:

/**
 * [description]
 *
 * @param [parameter name] - [Description of the parameter]
 */
export function demoFunction() { }

Components

  1. The docstring goes above the function
  2. It has a brief description of what the function does
  3. All parameters are mentioned and detailed accordingly

Example

/**
 * Handles the POST request for user login, validating the user credentials against the database.
 * Responds with a success message and status code 200 if the credentials are valid, or an error
 * message and status code 401 for invalid credentials, and 500 for any internal server errors.
 *
 * @param req - The incoming Next.js API request object, containing the username and password.
 * @param res - The outgoing Next.js API response object used to send back the result.
 */
export default async function handler(req: NextApiRequest, res: NextApiResponse) { }
@ColinLefter ColinLefter added the documentation Improvements or additions to documentation label Mar 1, 2024
@Hocng7
Copy link
Collaborator

Hocng7 commented Mar 2, 2024

Very good structure for our team to follow to keep our code organized, readable, and easier to modify if needed. Excellent work, Colin!

@ColinLefter ColinLefter pinned this issue Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

5 participants