Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

134
Views
JSDOC on socket.io emit

If I have socketio function like this :

_sock.emit('app_version',appversion,(response)=>{
   console.log(response)
})

and I want to put a proper JSDOC , explaining that appversion is a string, and response is a string, how do i write it ?

currently tried some combination like @param , or @property in WebStorm, yet Webstorm still don't recognize that appversion and response type.

Kindly help

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

JSDoc works best if you type things as you declare them, which doesn't work very well if you're doing things inline (such as using an inline arrow function. Try something like this, declaring and typing your variables and functions before using them:

// Use @type to indicate the type of the next following variable
/**
 * @type {string}
 */
let appversion;

// Use @param to indicate the param type of the next following function
/**
 * @param {string} response
 */
function doThing(response) {
  console.log(response);
}

_sock.emit('app_version', appversion, doThing);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!