# Fixing typedoc's generated TOC if your code is using ES6 modules

DevFeed: [Fixing typedoc's generated TOC if your code is using ES6 modules](<https://devfeed.tech/articles/fixing-typedoc-s-generated-toc-if-your-code-is-using-es6-modules-35551.md>)

Original publisher: [Read original article](<https://meowni.ca/posts/typedoc-toc/>)

Author: Monica Dinculescu

Published: 2020-02-21T00:00:00Z

Content type: tutorial

Language: en

Sources: [Monica Dinculescu](<https://devfeed.tech/sources/monica-dinculescu.md>)

Topics: [Documentation](<https://devfeed.tech/topics/documentation.md>), [TypeScript](<https://devfeed.tech/topics/typescript.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [es6](<https://devfeed.tech/topics/es6.md>), [modules](<https://devfeed.tech/topics/modules.md>)

Tags: [es6](<https://devfeed.tech/tags/es6.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [modules](<https://devfeed.tech/tags/modules.md>), [typescript](<https://devfeed.tech/tags/typescript.md>)

## AI overview

A tutorial describing a workaround for TypeDoc navigation when a TypeScript JavaScript library exports only selected files from its top-level index.ts. The author reports that several TypeDoc flags did not prevent private files from appearing in the main table of contents, and uses injected JavaScript to hide files that are not top-level exports.

## Source excerpt

My one policy about blogging is "write the blog post you wanted to find in the search results". I spent an inordinate amount of time yesterday trying to get typedoc to only show the docs for the files I'm actually exporting in my library, and didn't find anything on the internet to help me, so here is the blog post I wanted to read. The problem You are working on a JS library. You author your source in TypeScript. You have an index.ts file that exports only some of your source files. You would like your generated docs from typedoc to only have docs for those files (Why? So that people don't open issues along the lines of "I see the docs for function foo, but I can't see how to call it, pls export it". Sweet child, if that function was meant to be public it probably would've been. That function is actually 3 spiders in a trench coat). That is, you would like your Table of Contents to show this: and not this: Things that aren't solutions In the order that I've tried them: the --mode modules flag: the word "modules" is a lie here and really just means "under a namespace" not like... ES6 modules (tracking issue) the --excludeNotExported flag: it helps to generate docs for only the exported functions, but not files the -excludePrivate flag: same as above the --exclude flag: this is nice in theory, but I have like 30+ private files that shouldn't be documented and only like 5 top level exports, so that regex will suck. Also, my experience is that next time someone adds a file they want or don't want documented they won't know to add it to this list and we're back to having a problem the --toc flag. I honestly don't know what it does, but for me, it did nothing 100% of the time thinking this should presently work in typedoc. Here is the tracking issue and the open PR that might fix it. My "solution" I'm less bothered that the docs for the private files get generated at all, and more bothered that they're linked in the main page TOC and thus discoverable. So my "solution" tha