Breaks Google Closure type "optional" return type
turadg opened this issue · 3 comments
turadg commented
TypeScript supports the Google Closure style in JSDoc to indicate a param is optional:
/**
* @param {string=} p2 - An optional param (Google Closure syntax)
* @param {string} [p3] - Another optional param (JSDoc syntax).
*/
This formatter converts the former to the latter,
/**
* @param {string} [p2] - An optional param (Google Closure syntax) <-- NOT ANYMORE
* @param {string} [p3] - Another optional param (JSDoc syntax).
*/
That's fine because it means the same thing. The problem is it also does this for return types:
/** @returns {string=} */
becomes
/** @returns {string} */
That changes the type of the return from string | undefined
to string
, a breaking change.
hosseinmd commented
We could fix it, but I think that could be more cool if you change it to /** @returns {string | undefined} */
hosseinmd commented
Maybe this parser should do it too.
hosseinmd commented
Fixed V0.3.32