I'm developing a project that is using external dependencies from a node_module within it. Since those dependencies are part of the project, I'd like to add them to typedoc documentation, but what I get is just the string of the type declaration, not its content:
node_module/dependency/index.d.ts
export interface SomeInterface {
propA: string
propB: number
propC: string
}
...
// much more content I don't want to import from typedoc
my-project index.d.ts
import { SomeInterface } from 'dependency'
export type MyType = Pick<SomeInterface, 'propA' | 'propB'>
I don't add the node_modules dependency index.d.ts to the entryPoints
because it has a lot of content I don't want.
typedoc.json
{
"$schema": "https://typedoc.org/schema.json",
"entryPoints": [
"./src/index.d.ts",
],
"out": "api-docs"
}
Typedoc shows the string of how the type is declared, but it doesn't shows its content at all:
result in typedoc
Type alias MyType
MyType: Pick<SomeInterface, 'propA' | 'propB'>
desired result
Type alias MyType
MyType: {
propA: string
propB: number
}
I don't want to add the external dependency to the entryPoints
of typedoc because it has a lot of information that I don't need.
It isn't exactly what you're looking for, but TypeDoc's @interface
tag can get you close.
/** @interface */
export type MyType = Pick<SomeInterface, 'propA' | 'propB'>
This will result in TypeDoc documenting the type as if it were an interface, which will resolve all included properties.
If you really want a type alias, there is a small plugin which can be used to tell TypeDoc to document the type alias using the type which TypeScript shows when hovering over the type. This might someday be included directly in TypeDoc, but is not currently included.