Skip to content
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

@inheritDoc is not copying parameter documentation #787

Closed
kayahr opened this issue Jun 8, 2018 · 1 comment · Fixed by #1303
Closed

@inheritDoc is not copying parameter documentation #787

kayahr opened this issue Jun 8, 2018 · 1 comment · Fixed by #1303

Comments

@kayahr
Copy link

kayahr commented Jun 8, 2018

When using @inheritDoc then only the method documentation is copied. Parameter documentation is not copied.

Versions:

  • TypeDoc v0.11.1
  • Node v10.4.0

Reproduction code:

// test.ts
interface Base {
    /**
     * Base doc.
     *
     * @param p  Param doc.
     * @return Return value doc.
     */
    method(p: number): string;
}

class Test implements Base {
    /** @inheritDoc */
    method(p: number): string {
        return "";
    }
}
$ typedoc --out doc test.ts

Expected behavior:

The parameter p of the Test class must be documented with the text Param doc.

Actual behavior:

Parameter p is not documented at all. Only the name and type is printed to the HTML output.

The reason for this can be found in ImplementsPlugin.copyComment. This method only copies the parameter documentation when the parameter is already documented on the target method. This isn't the case when the method is simply annotated with @inheritDoc. There must be at least a @param p comment so the parameter documentation gets copied from the interface.

This can easily be fixed by reversing the logic. When target parameter is not already documented then copy documentation from the interface. This fixes the issue and also allows to write a more specific documentation for the parameter in the class.

This can be fixed with a few lines of code. Maybe I'll come up with a PR soon.

Gerrit0 pushed a commit that referenced this issue May 17, 2020
Original change by @kayahr in
#788 but was deleted
before the pull request could be merged.

Fixes #787
@Gerrit0
Copy link
Collaborator

Gerrit0 commented May 17, 2020

v0.17.7 released with this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants