Skip to content
Advertisement

How to return void in JsDoc?

Is there a specified way to declare a method or a function to return void in JsDoc? Currently I am in the belief that void is the default return value, and other return values must be specifically provided:

/**
 * @return {Integer} The identifier for ...
 */

Advertisement

Answer

I don’t believe you have to choose from a set of types in JsDoc… you can use any type name you wish (the curly braces indicate it’s a type), so you can simply do:

@return {void}

Although, this is probably more correct for JavaScript:

@return {undefined}
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement