Closed Dan503 closed 2 years ago
This problem also exists for {}
Input
interface Test {
/**
* The value
*
* @default {}
*/
value?: object
}
Output (unwanted change to @default
value)
interface Test {
/**
* The value
*
* @default
*/
value?: object
}
Unfortunately, jsdoc don't support array or object https://jsdoc.app/tags-default.html . This is a big problem I can't know how we could solve this, if we solve this it means we changed jsdoc standard
The documentation in JS Doc doesn't have specific examples on how to handle objects or arrays as default values.
It says this is the syntax
@default [<some value>]
Which suggests that maybe it wants arrays and objects to look like this:
// array
@default [[]]
//object
@default [{}]
I really don't like that syntax though. It looks like an array of arrays/objects.
Can this plugin just not delete []
and {}
in an @default
tag please?
If I made a PR to fix this issue, would you accept it?
Since this is just a code formatting plugin, I don’t see choosing not to delete something as going against JS Doc standard.
This isn't trying to transform valid JS Doc syntax into non-valid JS Doc syntax. This is just ignoring something the author is trying to write as valid syntax.
The plugin is overreaching at the moment trying to format something that the author doesn't want formatted.
Yes. Please PR.
I'm struggling a bit with figuring out where the in the code it deletes the []
and {}
from @default
:(
We used comment-parser
and it has a problem with this and your type deleted by it. Maybe we should move issue to comment-parser
Maybe though this is a good work around in the mean time.
Fixed v0.3.38
Input
Output (unwanted change to
@default
value)