-
-
Notifications
You must be signed in to change notification settings - Fork 750
Closed
Description
Search Terms
as const, enumerations
Problem
Since TypeScript's enum is rather inconvenient to work with, some packages define their own enum-like objects, TypeDoc does this too.
typedoc/src/lib/utils/entry-point.ts
Lines 15 to 35 in 664e27c
| /** | |
| * Defines how entry points are interpreted. | |
| * @enum | |
| */ | |
| export const EntryPointStrategy = { | |
| /** | |
| * The default behavior in v0.22+, expects all provided entry points as being part of a single program. | |
| * Any directories included in the entry point list will result in `dir/index.[tj]sx?` being used. | |
| */ | |
| Resolve: "resolve", | |
| /** | |
| * The default behavior in v0.21 and earlier. Behaves like the resolve behavior, but will recursively | |
| * expand directories into an entry point for each file within the directory. | |
| */ | |
| Expand: "expand", | |
| /** | |
| * Alternative resolution mode useful for monorepos. With this mode, TypeDoc will look for a package.json | |
| * and tsconfig.json under each provided entry point. The `main` field of each package will be documented. | |
| */ | |
| Packages: "packages", | |
| } as const; |
However, the generated documentation doesn't make it obvious that this value should be treated as an enumeration.
Suggested Solution
Detect variables annotated with @enum with all readonly properties that are string literals, and convert them as an enumeration.
If there is also a type alias by the same name whose content is typeof T[keyof typeof T], remove it from the documentation since enums are also types.
Metadata
Metadata
Assignees
Labels
No labels

