How to describe “object” arguments in jsdoc?

前端 未结 6 1436
迷失自我
迷失自我 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:10

    From the @param wiki page:


    Parameters With Properties

    If a parameter is expected to have a particular property, you can document that immediately after the @param tag for that parameter, like so:

     /**
      * @param userInfo Information about the user.
      * @param userInfo.name The name of the user.
      * @param userInfo.email The email of the user.
      */
     function logIn(userInfo) {
            doLogIn(userInfo.name, userInfo.email);
     }
    

    There used to be a @config tag which immediately followed the corresponding @param, but it appears to have been deprecated (example here).

提交回复
热议问题