Typedoc: TypeDoc renders main entry point containing only exports default and reexport declarations as empty

Created on 22 Sep 2017  路  11Comments  路  Source: TypeStrong/typedoc

I have an entry point index.ts for my library that contains only an export default and export declarations:

import Main from './Main'
export default Main

export { default as State } from './state'
export { default as ThingModel } from './state/Thing/Model'
export { default as ThingCollection } from './state/Thing/Collection'

// etc ...

When I generate docs via TypeDoc it is an empty file. I would expect it to list what is exported from this module:

empty

Most helpful comment

From a quick poke around, am I right in thinking this behavior is because typedoc only supports ts.SyntaxKind.ExportAssignment and the export syntax in use is ts.SyntaxKind.ExportDeclaration?

All 11 comments

Hi @octatone, how are you calling/what are you using for your typedoc configuration.

via shell:
typedoc --options ./config/typedoc.js --out ./docs ./src

typedoc.js:

module.exports = {
  mode: "modules",
  module: "umd",
  target: "ES5",
  externalPattern: "node_modules",
  excludeExternals: true,
  excludePrivate: true
}

index.ts lives at ./src/index.ts

I get the same empty output regardless of options or no options (default options).

From a quick poke around, am I right in thinking this behavior is because typedoc only supports ts.SyntaxKind.ExportAssignment and the export syntax in use is ts.SyntaxKind.ExportDeclaration?

I'm guessing this isn't going to be fixed anytime soon?

And how can the export syntax be changed from ExportDeclaration to ExportAssignment? Any idea?

This will be fixed by #801

801 was closed and replaced by #1157, which has been merged. I can't seem to get reexports to show up with the latest release, though.

Could you set up an example repo showing this problem? The tests for it are passing... seems to be working for me.

Here's my setup:

index.ts
typedoc.json

Only the default export shows up in the documentation:

image

Ah, nevermind, explicitly changing it to export {...} from syntax fixes this. Re-exporting the imports doesn't work though.

Ah, that makes some sense. Yet another reason coming back to why we need to use the type checker to get this information instead of walking the node tree and trying to figure it out ourselves... Glad you found a workaround for now.

Was this page helpful?
0 / 5 - 0 ratings