I am using @JSDoc to create documentation for my javascript library. I know how to indicate optional parameter. like below
/*
* @param {string} [somebody] - Somebody's name.
*/
function sayHello(somebody) {
if (!somebody) {
somebody = 'John Doe';
}
alert('Hello ' + somebody);
}
But I would like to indicate some parameters in my API are mandatory. How to indicate it using JSDOC. I don't find any from JSDoc tags-param
Unless you mark a parameter as optional, then the parameter is considered mandatory. There's nothing additional you need to do. To make your somebody
parameter mandatory you'd just remove the brackets:
@param {string} somebody - Somebody's name.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.