AaronNGray / jsdoc-toolkit

Automatically exported from code.google.com/p/jsdoc-toolkit
0 stars 0 forks source link

Support for @return with properties (same as @param) #265

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
As many functions return an object as an result, it would be nice to
document them like we can document the parameters.

Example - My function returns an object with 2 properties:
@return {Object} UriInformation
@return {String} UriInformation.hostName
@return {Integer} UriInformation.portNumber

Original issue reported on code.google.com by bkonet...@gmail.com on 9 Nov 2009 at 10:11

GoogleCodeExporter commented 9 years ago
Given the existing syntax of:
    @return {returnType} returnDescription
Your proposal is probably impossible to make backwards compatible, because it 
is not possible to distinguish 
between the [name of the return value] and [the first words of the description].

@return {Stuff} Objects that have stuff.
@return {Stuff} Objects.Or some other things.

You can accomplish what you want with existing tags though, you can either 
describe the return value 
properties in the returnDescription directly, or you can document a class for 
the returned object like this:

/**
    @class
    @name UriInformation
    @property {String} hostName
    @property {Integer} portNumber
 */

/**
    @name getUriInformation
    @function
    @returns {UriInformation}
 */

Original comment by micmath on 9 Nov 2009 at 12:24