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

Descriptions of overridden methods are missing. #1580

Closed
donmccurdy opened this issue May 3, 2021 · 6 comments · Fixed by redpeacock78/cie.js#6
Closed

Descriptions of overridden methods are missing. #1580

donmccurdy opened this issue May 3, 2021 · 6 comments · Fixed by redpeacock78/cie.js#6
Labels
bug Functionality does not match expectation

Comments

@donmccurdy
Copy link

Search terms

inherit, inherited, override, overridden, missing documentation

Expected Behavior

If a parent class declares a method that is overridden by child classes, the description provided with the parent method should be shown unless a child class provides its own description.

Actual Behavior

If the child class does not provide a new method description when overriding a method, no method description is rendered in the docs.

Steps to reproduce the bug

Given a simple project...

/** Class is documented. */
export class A {
    /** This method does a thing. */
    run(): void {
        console.log('A');
    }
}

/** Class is documented. */
export class B extends A {
    run(): void {
        super.run();
        console.log('B');
    }
}

/** Class is documented. */
export class C extends B {
    run(): void {
        super.run();
        console.log('C');
    }
}

... generate documentation with something like:

typedoc src/core.ts --out docs/ --excludeNotDocumented --theme minimal

The problem occurs whether --excludeNotDocumented is given or not, but the flag is helpful to my project so I thought I'd call it out as an additional case here: missing documentation on a child class does not prevent the method from appearing in the docs; only the description goes missing.

Despite the documenation on A.run above, inspecting C.run will show no description:

Screen Shot 2021-05-02 at 10 21 56 PM

Environment

  • Typedoc version: 0.20.36
  • TypeScript version: 4.2.4
  • Node.js version: 14.14.0
  • OS: macOS Big Sur 11.3
@donmccurdy donmccurdy added the bug Functionality does not match expectation label May 3, 2021
@donmccurdy
Copy link
Author

Forgot to mention — this case was working for me pre-0.20, I ran into the issue when attempting to upgrade.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented May 3, 2021

That's really weird... I could have sworn we had a test case for this one.

@donmccurdy
Copy link
Author

Here's a stripped-down version of my project if it's helpful:

DocsRepro.zip

Methods that are inherited but not overridden are displayed just fine, it's just undocumented overrides that lose descriptions.

@Gerrit0 Gerrit0 added this to To do in Version 0.21 via automation May 15, 2021
@Gerrit0 Gerrit0 moved this from To do to Done in Version 0.21 May 15, 2021
@donmccurdy
Copy link
Author

Thanks @Gerrit0! Unfortunately the bugfix in d5bb930 appears to fix the simple A>B>C case provided above, but not another version of the problem in the same .ZIP file above. The class inheritance hierarchy is:

  • Property
    • ExtensibleProperty
      • Camera

Property.ts defines a copy(...) method, and each subclass overrides it. The description of the method is shown for the first two, but not for Camera... I'm not sure why that would behave differently than the A>B>C example earlier.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jun 21, 2021

Aww shoot, I don't think I ever even downloaded the zip. I'll have to take another look

@Gerrit0 Gerrit0 reopened this Jun 25, 2021
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jun 25, 2021

Shoot. This is because of reflection ordering... The fix for this requires the implements plugin keeping track of inheritance so that it doesn't do child classes before parent classes.

Analyze inheritance B
Analyze inheritance C
Analyze inheritance Camera
Analyze inheritance ExtensionProperty
Analyze inheritance ExtensibleProperty
Analyze inheritance Property
Analyze inheritance Node
Analyze inheritance Scene

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality does not match expectation
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants