Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'split' of undefined #301

Closed
damirka opened this issue Jun 22, 2016 · 7 comments
Closed

TypeError: Cannot read property 'split' of undefined #301

damirka opened this issue Jun 22, 2016 · 7 comments

Comments

@damirka
Copy link

damirka commented Jun 22, 2016

Getting this error when trying to generate docs for multiple files.

Here is a log:

badge.svg
identifiers.html
index.html
class/components/redis/Connection.js~Connection.html
class/components/errors/DebugError.js~DebugError.html
class/components/errors/EmptyDataError.js~EmptyDataError.html
/usr/lib/node_modules/esdoc/out/src/Publisher/Builder/ClassDocBuilder.js:79
            throw _iteratorError;
            ^
TypeError: Cannot read property 'split' of undefined
    at /usr/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:1287:53
    at IceCap.loop (/usr/lib/node_modules/esdoc/node_modules/ice-cap/out/src/IceCap.js:261:9)
    at ClassDocBuilder._buildProperties (/usr/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:1285:11)
    at /usr/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:651:41
    at IceCap.loop (/usr/lib/node_modules/esdoc/node_modules/ice-cap/out/src/IceCap.js:261:9)
    at ClassDocBuilder._buildDetailDocs (/usr/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:606:11)
    at ClassDocBuilder._buildDetailHTML (/usr/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:568:29)
    at ClassDocBuilder._buildClassDoc (/usr/lib/node_modules/esdoc/out/src/Publisher/Builder/ClassDocBuilder.js:172:44)
    at ClassDocBuilder.exec (/usr/lib/node_modules/esdoc/out/src/Publisher/Builder/ClassDocBuilder.js:64:36)
    at publish (/usr/lib/node_modules/esdoc/out/src/Publisher/publish.js:169:59)

And this is my config:

{
  "access": ["public", "protected", "private"],
  "source": "./app/components",
  "destination": "./out/esdoc",
  "undocumentIdentifier": true,
  "unexportIdentifier": true,
  "autoPrivate": false,
  "lint": false
}
@moroine
Copy link

moroine commented Jun 23, 2016

Same issue on my side

@damirka
Copy link
Author

damirka commented Jun 23, 2016

To @moroine:

I've found a way to fix this but it's completely incorrect and weird. Just added this condition:

// in /usr/lib/node_modules/esdoc/out/Publisher/Builder/DocBuilder#1288
if (prop.name === undefined) {
    return ice;
}

If you need a quick fix to generate docs - this can work. But I don't recommend to do it in any other case.

UPD: There's an ice.loop('property', properties, function (i, prop, ice) { ... }) block and in some cases (I didn't go further) prop can be an empty object or smth. So the name property is undefined.

It's funny that I've been migrating from JSDoc and after I removed some JSDoc tags (as I see now) it began to work properly even without this fix. 🎱

@make-github-pseudonymous-again
Copy link

make-github-pseudonymous-again commented Nov 2, 2016

Here's an example that throws a similar error

export class Product {

    constructor ( a , b ) {
        this.a = a ;
        this.b = b ;
    }

    zero ( ) {
        return [ this.a.zero( ) , this.b.zero( ) ] ;
    }

    plus ( [ a , b ] , [ A , B ] ) {
        return [ this.a.plus( a , A ) , this.b.plus( b , B ) ] ;
    }

}

Commenting out the plus method or adding

    /**
     * @param first
     * @param second
     */

just before the plus method makes esdoc work again.

@damirka
Copy link
Author

damirka commented Nov 2, 2016

Seems to me it's somehow related to destructive assignment and it's parsing. Did you try any other ways?

// like this one
function example({ a: A, b: B }, c = null, [ d = null ]) {
  // check params inside
}

@make-github-pseudonymous-again

No but I think your guess is correct.

@h13i32maru
Copy link
Member

Thanks for this report.

I will fix this bug in next version.

@h13i32maru
Copy link
Member

I fixed this bug.
c8ae3f5

And will release in next version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants