Support string/numeric/boolean literal types
jfirebaugh opened this issue · 4 comments
JSDoc supports, e.g.:
/**
* @typedef {Object} Comment
* @property {('public'|'protected'|'private')} access
*/
jsdoc -X
output looks like:
...
"properties": [
{
"type": {
"names": [
"'public'",
"'protected'",
"'private'"
]
},
"name": "access"
}
],
...
This is useful to support enumerated types. See, for instance, jsdoc/jsdoc#629, jsdoc/jsdoc#1065, and documentationjs/documentation#373.
And what happens when you try to parse it with Doctrine? I'm assuming you're saying something isn't working, but a full bug report with what you did, you happened, what you expected, etc. would be very helpful.
Ah, yeah, sorry. The comment fails to parse with doctrine. If you have the recoverable
option set, you can get back an error message, which is "unexpected token".
I don't have time to look into this at the moment, but I'd be happy to review a pull request.
Created #172 to add support for numeric and string literals. Boolean literal support is slightly more complicated, but I can work on that if there is a desire for it.