How to describe “object” arguments in jsdoc?

前端 未结 6 1435
迷失自我
迷失自我 2020-11-28 00:39
// My function does X and Y.
// @params {object} parameters An object containing the parameters
// @params {function} callback The callback function
function(paramet         


        
6条回答
  •  失恋的感觉
    2020-11-28 01:04

    There's a new @config tag for these cases. They link to the preceding @param.

    /** My function does X and Y.
        @params {object} parameters An object containing the parameters
        @config {integer} setting1 A required setting.
        @config {string} [setting2] An optional setting.
        @params {MyClass~FuncCallback} callback The callback function
    */
    function(parameters, callback) {
        // ...
    };
    
    /**
     * This callback is displayed as part of the MyClass class.
     * @callback MyClass~FuncCallback
     * @param {number} responseCode
     * @param {string} responseMessage
     */
    

提交回复
热议问题