Search code examples
google-closuregoogle-closure-libraryjsdoc

Extending goog.Disposable generates jsDoc error


One of my classes generates a jsDoc error because it is extending goog.Disposable. I am using @extends to specify this, but it's still not working. Files compile without errors with the closure linter. the code can be found here"


Solution

  • Your JavaScript file contains the following line:

    goog.inherits(goog.Disposable, niuzly.base.errorHandler);
    

    goog.inherits takes the child constructor followed by the parent constructor:

    goog.inherits(niuzly.base.errorHandler, goog.Disposable);
    

    For a JSDoc-Toolkit template, you could try gcodewiki. Using gcodewiki, I successfully generated JSDoc for your file niuzly.base.errorHandler.js with the following warnings:

    >> WARNING: Trying to document errorHandler as a member of undocumented symbol niuzly.base.
    >> WARNING: Can't augment contributer: goog.Disposable, not found.
    

    Including Closure Library's base.js and disposable.js as inputs to JSDoc-Toolkit eliminates the warning Can't augment contributer: goog.Disposable, not found.

    To eliminate the warning about the undocumented symbol niuzly.base, you could add the following to your source file or just ignore the warning.

    /**
     * @type {Object} Namespace for Niuzly Inc.
     */
    var niuzly = niuzly || {};
    
    /**
     * @type {Object} Base namespace.
     */
    niuzly.base = niuzly.base || {};
    

    JSDoc 3

    Using JSDoc 3 instead of the older JSDoc-Toolkit successfully generated documentation when only niuzly.base.errorHandler.js and disposable.js were specified. In addition, there was no warning about the undocumented symbol niuzly.base.