In TypeDoc, can I create a doc comment for a method a child class inherits from its parent without having to override that method in the child class?

133 views Asked by At

In TypeDoc, can I create a doc comment for a function a child class inherits from its parent without having to override that function in the child class and adding a doc comment to that override implementation?

I want to "override" the inherited doc comment for the child's function without having to implement that function as an override in the child class if possible.

class Parent<T>
{
    readonly #tProp: T;

    public constructor(tArg: T)
    {
        this.#tProp = tArg;
    }

    /** Getter for the tProp */
    public tProp(): T { return this.#tProp; }
}

/*
 * Is it possible to add doc comment to replace doc comment
 * for tProp getter inherited from Parent class without having
 * to add override implementation for tProp getter?
 */
class Child extends Parent<string>
{
    public constructor(stringProp: string)
    {
        super(stringProp);
    }
}
    
1

There are 1 answers

3
Gerrit0 On BEST ANSWER

This is supposed to be possible with @property

/**
 * @property tProp overriden description
 */
class Child extends Parent<string>
{
    public constructor(stringProp: string)
    {
        super(stringProp);
    }
}

But this doesn't work in 0.25.0 due to a bug I just fixed, it will work in the next release.