javascript - How do I JSDoc @param in webstorm a callback handler's parameters? -


i trying use jsdoc hinting on parameter of handler doesn't work. have tried @type , @param , not work. official jsdoc did not contain helpful information regarding problem.

this not work:

    socket.on( "data",     /**      * @param request {object}      * @param request.code {number}      * @param request.id {number}      * @param request.sr {string}      */     function( request )     {}); 

you can use complex "typedef" , "property" tags. documented in: http://usejsdoc.org/tags-typedef.html however, "~" char seems prevent webide link type annotations. (just use plain typedef mytype annotation without tilde , works)

btw, google closure way:

/** @typedef {{code: number, id: number, str: string}} **/ socketrequest;  socket.on("data", handler);  /**  * @param {socketrequest} req  */ function handler(req) {     //req hinted here } 

this jsdoc annotation google closure, can used without closure sake of hinting. (should work since august 2012: http://blog.jetbrains.com/webide/2012/08/closure-syntax/)


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -