Schemiii
Schemiii

Reputation: 366

Proper JSDoc typedef declaration of function with optional arguments in javascript

Given following typedef

/***
 * @typedef {object} Queue
 * @property {function(string):string[]} listQueueNames Gets an optionally 
   filtered list of QueueNames. 
 */

What is a proper way to mark listQueueName's Argument as an optional Argument ?

Upvotes: 1

Views: 1552

Answers (1)

lena
lena

Reputation: 93868

Using Closure Compiler syntax should work here:

/***
 * @typedef {object} Queue
 * @property {function(string=):string[]} listQueueNames Gets an optionally 
   filtered list of QueueNames. 
 */

Upvotes: 2

Related Questions