-
Notifications
You must be signed in to change notification settings - Fork 674
Description
Summary
Suppose we have the following class setup:
export class B {
b: string;
}
export class A extends B {
a: string;
}
Today, api-documenter will write two API documentation pages: one for A and one for B. It will list a under A and b under B. Notably, in the documentation page for A, there will be no indication that A inherits b (or any other additional properties/methods) other than the A extends B clause written to A's documentation page. A developer needs to "jump back and forth" between the documentation pages for A and B in order to understand A's full API.
I think we can do better. It should be possible to configure api-documenter to show a class's inherited members within its own API documentation page. The example above is for class inheritance, but all of the above applies to interface inheritance as well.
For a live example of this feature in TypeDoc, please see https://typedoc.org/api/classes/Application.html, in particular the "Inherited" checkbox on the top-right.
Details
Implementation details:
- This issue was opened with the
[api-documenter]tag, but we should also make a change to api-extractor-model to make it easier to find a declaration's inherited members. - Note that getters/setters split across the inheritance chain may need to be handled specially (see Update ae-missing-getter documentation api-extractor.com-website#47).
Some open questions:
- There should be an indication of some kind that a member is inherited (e.g. special formatting, a badge/tag, separate section, etc). What should this look like?
- Should we also show members inherited from a declaration in a separate package? Suppose in the example above,
Bis in a separate package. The.api.jsonfile forA's package won't include any information aboutBorb. If we wanted to support this, we'd need to make a change to api-extractor as well.
Standard questions
Please answer these questions to help us investigate your issue more quickly:
| Question | Answer |
|---|---|
@microsoft/api-documenter version? |
Latest |
| Operating system? | All |
| Documentation target? | All |
| Would you consider contributing a PR? | Yes |
| TypeScript compiler version? | N/A |
Node.js version (node -v)? |
N/A |