I'm learning to use TypeDoc (version 0.22.12) to write documentation in my typescript/node.js project.

I organized my project such that I have a utilities folder with one .ts file per one utility function.

.
│   package.json
│   tsconfig.json
│
└───src
    │   index.ts
    │
    └───utils
            addNumbers.ts
            subNumbers.ts

addNumbers.ts contents, for example:

// addNumbers.ts
export function addNumbers(a: number, b: number): number { 
    return a + b; 
} 

Likewise, subNumbers.ts:

// subNumbers.ts
export function subNumbers(a: number, b: number): number { 
    return a - b; 
} 

I want to document each function, for example using TypeDoc's @param and @returns.

So I write:

// addNumbers.ts
/**
 * Function to add two numbers
 * @param a the first number
 * @param b the second number
 * @returns number equal to the addition of a and b
 */
export function addNumbers(a: number, b: number): number { 
    return a + b; 
}

Then, when I execute

npx typedoc --out docs

I get

Info: Documentation generated at ./docs

So I go to ./docs/modules.html, right-click and then open with live server (VSCode), and I get a webpage with nothing under Exports section.

What am I doing wrong?


It may be worth noting that I added the following to my tsconfig.json file:

"typedocOptions": {
  "entryPoints": ["src/index.ts"],
  "out": "docs"
}

I'm not sure whether the problem lies in that tsconfig.json.

0

There are 0 answers