Skip to content

Add support for documenting class properties #417

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

Closed
kripod opened this issue May 7, 2016 · 5 comments
Closed

Add support for documenting class properties #417

kripod opened this issue May 7, 2016 · 5 comments

Comments

@kripod
Copy link
Contributor

kripod commented May 7, 2016

https://github.com/jeffmo/es-class-fields-and-static-properties

Adding support for documenting those would greatly improve my workflow, as I would't have to explicitly use getters and setters for each class property. Also, the @property JSDoc tag before a class declaration doesn't behave as expected for my use case.

@jfirebaugh
Copy link
Member

jfirebaugh commented May 8, 2016

Can these be documented using @memberof Class, and @static or @instance, the normal tags for static and instance properties?

@kripod
Copy link
Contributor Author

kripod commented May 8, 2016

That did work, thanks for the heads-up! Although, it'd be great if I didn't have to use those 2 extra tags.

export default class ModelBase {
  /**
   * Plugins to be used for the current ORM instance.
   * @type {Object[]}
   * @memberof ModelBase
   * @static
   */
  static plugins = [];
}

For those who are curious, my actual implementation mentioned above can be found here.

@jfirebaugh
Copy link
Member

If you leave out @memberof ModelBase, is it inferred from the context? It should be, but I'm not sure of the status of documentation.js support for ES6 class inference.

@kripod
Copy link
Contributor Author

kripod commented May 9, 2016

No, the context is not detected correctly: in the example above, plugin gets treated as if it was hierarchically on the same level as ModelBase.

@tmcw
Copy link
Member

tmcw commented Aug 9, 2017

🍏 This works in current documentation.js 5.x

In:

/**
 * This is the model base.
 */
export default class ModelBase {
  /**
   * Plugins to be used for the current ORM instance.
   * @type {Object[]}
   * @memberof ModelBase
   * @static
   */
  static plugins = [];
}

Out:

### Table of Contents

-   [ModelBase](#modelbase)
    -   [plugins](#plugins)

## ModelBase

This is the model base.

### plugins

Plugins to be used for the current ORM instance.

@tmcw tmcw closed this as completed Aug 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants