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

Error message for private subclass of public superclass #105

Open
willeastcott opened this issue Nov 18, 2019 · 3 comments
Open

Error message for private subclass of public superclass #105

willeastcott opened this issue Nov 18, 2019 · 3 comments
Labels

Comments

@willeastcott
Copy link

The following JavaScript:

/**
 * @constructor
 * @name Animal
 * @classdesc An animal.
 * @description Creates a new animal.
 */
function Animal() {
    this.x = 0;
    this.y = 0;
}

/**
 * @function
 * @name Animal#move
 * @description Move the animal to the specified location.
 * @param {Number} x - X-coordinate.
 * @param {Number} y - Y-coordinate.
 */
Animal.prototype.move = function (x, y) {
    this.x = x;
    this.y = y;
}

/**
 * @private
 * @constructor
 * @name Dog
 * @extends Animal
 * @classdesc A dog.
 * @description Creates a new dog.
 */
function Dog() {}

Dog.prototype = Object.create(Animal.prototype);
Dog.prototype.constructor = Dog;

/**
 * @private
 * @function
 * @name Dog#bark
 * @description The dog barks.
 */
Dog.prototype.bark = function () {
    console.log('Woof!');
}

...generates this message:

[TSD-JSDoc] Failed to find parent of doclet 'Dog#move' using memberof 'Dog', this is likely due to invalid JSDoc.

This bug is currently afflicting the PlayCanvas engine. See forum post.

@englercj
Copy link
Owner

englercj commented Dec 1, 2019

Look like this is because the move function is not marked private by jsdoc so we try to document it. When we try to lookup where it belongs we fail to find the Dog class because it is private.

The implementation should probably still track private objects so we can tell the difference between an unknown symbol and an existing, but private, symbol. In the later case we can skip the move/bark functions and not output the warning.

@aidinabedi
Copy link
Contributor

This issue is fixed now by merged PR #126 in latest release

@thw0rted
Copy link

It looks like #126 did not fix this; at the very least, there should be a test case for this specific problem (@private class, with a @memberof tag on a prototype function) and the tests added for that PR definitely do not include one.

@englercj englercj reopened this May 29, 2020
aidinabedi added a commit to aidinabedi/tsd-jsdoc that referenced this issue Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants