typedoc icon indicating copy to clipboard operation
typedoc copied to clipboard

Constructor property parameters are not documented when --excludeNotDocumented is on

Open judax opened this issue 5 years ago • 8 comments

Search Terms

constructor parameter property documentation

Problem

When using --excludeNotDocumented, a class that declares properties in the constructor the properties do not seem to be documented correctly even with @param.

class X {
  /**
   * Instantiates X.
   * @param prop The property of X.
   */
  constructor(readonly prop: number) {
  }
}

Suggested Solution

judax avatar Apr 07 '20 01:04 judax

This is not a suggestion, but a bug. Sorry for the wrong labelling.

judax avatar Apr 07 '20 01:04 judax

@SamuraiJack you might be interested in this

Gerrit0 avatar Apr 07 '20 02:04 Gerrit0

Thanks for the report, I'll check soon

canonic-epicure avatar Apr 07 '20 08:04 canonic-epicure

Can not reproduce this one. I'm testing with this class definition:

/**
 * Has docs
 */
export class BaseClass {
    /**
     * Has docs
     */
    some        : number
    // no docs
    protected kind: number;

    /**
     * Has docs
     */
    static instance: BaseClass;

    // no docs
    static instances: BaseClass[];

    /**
     * Has docs
     * @param name
     */
    constructor(readonly name: string){
    }
}

And the result is: image

The constructor seems to be properly documented.

Command line:

node ../../bin/typedoc --includes inc/ --media media/ --target ES5 --json json.json --out doc/ src/ --excludeNotDocumented

@judax Any additional info?

canonic-epicure avatar Apr 21 '20 16:04 canonic-epicure

@judax Perhaps you did not include the docs for the class itself? Then the whole class won't be included.

canonic-epicure avatar Apr 21 '20 16:04 canonic-epicure

Your test works but I still cannot make my code work:

/** Represents a 2 float structure (i.e. a point in 2D). */
export class Float2 {
  /**
   * Constructs a 2 float structure instance.
   *
   * @param x The x component of the 2 float structure.
   * @param y The y component of the 2 float structure.
   */
  constructor(readonly x: number, readonly y: number) {}
}

Here are my command line options:

typedoc --excludeNotDocumented --ignoreCompilerErrors --excludePrivate --excludeProtected --readme none --mode file --theme MY_DEFAULT_THEME_PATH

judax avatar Apr 23 '20 00:04 judax

Ok, thanks for the info!

canonic-epicure avatar Apr 23 '20 09:04 canonic-epicure

Seems to me related to #584.

It also seems to me that there is no way to add Documentation to the auto-generated Properties (only the Parameters):

/** KvStore implements ...
*/
export class KvStore implements IKvStore {
  /** Generate a KvStore instance for a specific [[Datastore]] instance.
...
  @param datastore A [[Datastore]] instance. Can be freely accessed by the client. Be aware that using this inside [[runInTransaction]] ignores the transaction.
  @param projectId The `GCLOUD_PROJECT ID`. Used for Key generation during serialization.
  */
  constructor(readonly datastore: Datastore, readonly projectId?: string) {
    assertIsObject(datastore)
  }

Generated Doc

mdornseif avatar Dec 14 '21 11:12 mdornseif