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

Option to inherit interface documentation by default #1498

Closed
RunDevelopment opened this issue Feb 6, 2021 · 8 comments
Closed

Option to inherit interface documentation by default #1498

RunDevelopment opened this issue Feb 6, 2021 · 8 comments
Labels
enhancement Improved functionality

Comments

@RunDevelopment
Copy link
Contributor

Search Terms

inheritdoc, inherit documentation, configuration option

Problem

Class methods/accessors/properties that implement interface members do not inherit the interface's documentation.

This very annoying because the reader has to click on the Implementation of X note to be able to read the documentation of class members.

IDEs like VSCode do not have this problem. They will display the interface's documentation for inherited members if the implementation doesn't define its own documentation.

Example: No documentation at definition site

image

But VSCode still displays documentation.

image

The only current solution for this problem is to add a /** @inheritDoc */ to all class members without documentation.

Suggested Solution

Add a new configuration option that will add an implicit @inheritDoc if a class member does not define its own documentation.

At least, this is how the solution is supposed to behave. It may be implemented differently of course.

@RunDevelopment RunDevelopment added the enhancement Improved functionality label Feb 6, 2021
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Feb 6, 2021

I could have sworn we already did this... but apparently not... maybe I imagined it, or did it on a branch that never ended up getting merged.

@Gerrit0 Gerrit0 closed this as completed in ccd519a Feb 6, 2021
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Feb 6, 2021

With 0.20.23 we do this by default, decided to treat this as a bug report since I was pretty sure we should have been doing this in the first place.

@RunDevelopment
Copy link
Contributor Author

Wow. All of my issues fixed in record time! Thank you @Gerrit0!

@harrydehix
Copy link

This doesn't seem to work on more complex types (IDEs like vscode doesn't have this problem).

Example:
I have interface A...

export interface A {
    /**
     * x
     */
    x: number;

    /**
     * z
     */
    z: number;
}

interface B...

export interface B {
    /**
     * y
     */
    y: number;
}

... and class C:

import { A } from "./interfaceA";
import { B } from "./interfaceB";

export class C implements Omit<A, "z">, B {
    x = 0;
    y = 0;
}

Using the official typescript utility type Omit causes the documentation of interface A to disappear completely.
grafik

vscode manages this fine:
grafik

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Mar 30, 2022

Please open a new issue rather than posting in an old one.

@frank-weindel
Copy link

@harrydehix Did you create a new issue for this? Otherwise I will!

@birkskyum
Copy link

This still appear to be a problem in version 0.24.8 - the docs from the interface doesn't follow into the class implementing it unless I add inheritDoc to every method

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jul 3, 2023

Please open a new issue rather than posting in an old one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improved functionality
Projects
None yet
Development

No branches or pull requests

5 participants