-
-
Notifications
You must be signed in to change notification settings - Fork 169
Closed
Description
With auto fix
I would like to disallow optional parameters notation with question mark character ?.
Disallow this:
/**
* @param {string?} foo Optional parameter.
*/and this:
/**
* @param {?string} foo Optional parameter.
*/In favor of this (auto fixed):
/**
* @param {string} [foo] Optional parameter.
*/Actually both {string?} and {?string} cannot be disallowed and leads to inconstancy when writing optional parameter notation.
Also I'm not sure about the {string} [foo] notation, is this really the "official" notation to use when writing optional parameters?
I think so 🤔 https://jsdoc.app/tags-param.html#optional-parameters-and-default-values
An optional parameter (using JSDoc syntax)
/** * @param {string} [somebody] - Somebody's name. */ function sayHello(somebody) { if (!somebody) { somebody = 'John Doe'; } alert('Hello ' + somebody); }
Metadata
Metadata
Assignees
Labels
No labels