Replies: 1 comment
-
You could do this with a plugin, there isn't a builtin way to do this type of thing. typedoc --plugin ./exclude_component.js src/index.ts // @ts-check
import * as td from "typedoc";
/**
* @param {td.SomeType | undefined} type
* @param {string} name
*/
function isReactType(type, name) {
return type?.type === "reference" && type.package === "@types/react" && type.name === name;
}
/** @param {td.Application} app */
export function load(app) {
// Functions
app.converter.on(td.Converter.EVENT_CREATE_SIGNATURE, (_context, sig) => {
if (isReactType(sig.type, "Element")) {
sig.comment ||= new td.Comment();
sig.comment.modifierTags.add("@ignore");
}
});
// Classes
app.converter.on(td.Converter.EVENT_CREATE_DECLARATION, (_context, decl) => {
if (decl.kindOf(td.ReflectionKind.Class) && decl.extendedTypes?.some(t => isReactType(t, "Component"))) {
decl.comment ||= new td.Comment();
decl.comment.modifierTags.add("@ignore");
}
});
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We have a lot of React components in our monorepo, but these are not worthwhile to show in API docs (it's just not the right forum for documenting components). Is there a way to exclude only React components, but leave alone other functions and classes?
Beta Was this translation helpful? Give feedback.
All reactions