Sunday, May 19, 2024
126
rated 0 times [  132] [ 6]  / answers: 1 / hits: 86398  / 13 Years ago, tue, may 3, 2011, 12:00:00

According to the JSDoc wiki for @param you can indicate a @param is optional using



/**
@param {String} [name]
*/
function getPerson(name) {
}


and you can indicate a param inline using



function getPerson(/**String*/ name) {
}


And I can combine them like the following, which works ok.



/**
@param [name]
*/
function getPerson(/**String*/name) {
}


But I would like to know if there is a way to do it all inline if possible.


More From » google-closure-compiler

 Answers
1

I found a way to do this using Google Closure Compiler type expressions. You put an equals sign after the type like so:
function test(/**String=*/arg) {}


[#92427] Sunday, May 1, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
zainsagez

Total Points: 555
Total Questions: 99
Total Answers: 96

Location: Honduras
Member since Sat, Jul 24, 2021
3 Years ago
;