Expected `OptionalType` param with default value but found `number` and `null`.
chriswong opened this issue · 2 comments
chriswong commented
/**
* foo
*
* @param {number} [foo = 1] desc
*/
var jsdoc = doctrine.parse(
'/**\n'
+ ' * foo\n'
+ ' *\n'
+ ' * @param {number} [foo = 1] desc\n'
+ ' */'
,
{
strict: true,
unwrap: true,
sloppy: true,
lineNumbers: true,
recoverable: true
}
);
JSDoc Object:
{
"description": "foo",
"tags": [{
"title": "param",
"description": "= 1] desc",
"lineNumber": 3,
"type": null,
"name": "number"
}]
}
Expect:
{
"description": "foo",
"tags": [{
"title": "param",
"description": "desc",
"lineNumber": 3,
"type": {
"type": "OptionalType",
"expression": {
"type": "NameExpression",
"name": "number"
}
},
"name": "foo",
"default": "1"
}]
}
I'd fixed it up in our fork:
ecomfe@17faaa8
nzakas commented
Thanks. Do you want to submit a PR for this change? (Please see our contribution guidelines: http://eslint.org/docs/developer-guide/contributing/pull-requests)
chriswong commented
Yes, it's my pleasure.Working on it.