Optional parameter annotation in JSDoc

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Optional parameter annotation in JSDoc

Postby roddy » Tue Nov 17, 2020 1:32 am

It would be great to have a way of marking a parameter as "Optional" in the JSDoc annotations for a function; this would alleviate the many warnings through the code. By having this as an annotation, it would be easier to determine an actual function being called with incorrect parameters.

Can this be added to Servoy?
roddy
 
Posts: 100
Joined: Mon Oct 26, 2020 12:32 am

Re: Optional parameter annotation in JSDoc

Postby Richard1521662995 » Tue Nov 17, 2020 11:48 am

Hi,

You can use [] around the parameter.

@param {String} [myParameter]


Richard
Richard Clarke
acss.co.uk
Richard1521662995
 
Posts: 39
Joined: Wed Mar 21, 2018 10:09 pm

Re: Optional parameter annotation in JSDoc

Postby roddy » Wed Nov 18, 2020 12:12 am

That works so well; thanks. This has cleared up so much :-)
roddy
 
Posts: 100
Joined: Mon Oct 26, 2020 12:32 am


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 9 guests