jsdoc-to-markdown icon indicating copy to clipboard operation
jsdoc-to-markdown copied to clipboard

@hideconstructor does not hide constructor

Open ozum opened this issue 7 years ago • 5 comments

Hi,

I'm using @hideconstructor to hide constructor from markdown documents. I even coupled it with @private, but constructor is always documented.

Example (I tried every combination of @private and @hideconstructor)

/**
 * Some details
 * @public
 * @hideconstructor
 */
class MyClass {
  /**
   * Constructor details
   * @private
   * @hideconstructor
   */
  constructor() {
    this.attr = 1;
  }
}

Kind Regards,

ozum avatar Feb 21 '18 05:02 ozum

Needs some investigation, thanks. Historically, there was a reason @private had no effect on constructors (because jsdoc output made no distinction between a class and function declaration, i think) but it needs revisiting, since jsdoc has been updated.

75lb avatar Feb 27 '18 09:02 75lb

any updates on this?

curquhart avatar Apr 13 '18 05:04 curquhart

does this input code produce the desired output in jsdoc v3.6.2?

75lb avatar May 22 '19 11:05 75lb

does this input code produce the desired output in jsdoc v3.6.2?

@75lb, I checked with jsdoc v3.6.2 now. Yes it produces desired ouput with @hideconstructor.

ozum avatar May 22 '19 11:05 ozum

After much painful experimentation, I noticed a possible workaround for this issue. Currently, it seems that class constructors show up (or not) in the doc output depending on whether or not there is any description text in the class comment.

That is, with source like this the constructor shows up in the output for me:

/**
 * Here's a description
 * @class
 * @hideconstructor
*/

function Foo() {
	/** a property */
	this.property = 1
	/** method */
	this.method = function () { }
}

But when I remove the untagged description text, I get no constructor in the doc output:

/**
 * @class
 * @classdesc Here's a description
*/

function Foo() {
	/** a property */
	this.property = 1
	/** method */
	this.method = function () { }
}

For me @hideconstructor has no apparent effect either way.

fenomas avatar Jul 12 '19 12:07 fenomas