Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

Expected OptionalType param with default value but found number and null. #141

Closed
chriswong opened this issue Dec 21, 2015 · 2 comments
Closed

Comments

@chriswong
Copy link
Contributor

/**
 * 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
Copy link
Member

nzakas commented Dec 21, 2015

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
Copy link
Contributor Author

Yes, it's my pleasure.Working on it.

@nzakas nzakas closed this as completed in ae07aa8 Jan 13, 2016
nzakas added a commit that referenced this issue Jan 13, 2016
Fix: Allow whitespace in optional param with default value (fixes #141)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants