Skip to content

Support for enum-like object declarations enums #1740

@michkot

Description

@michkot

Search Terms

as const enum
enum-like objects
union of literals

Problem

The support for #1675 works only for .ts files, but not for .d.ts files (not even those generated from the supported syntax). Could the suport for "as const" object enums be extended for enum-object declarations?
See the #1675 for full context.

eg. in addition to

/** @enum /
export const EntryPointStrategy = {
/
*
* abcd
*/
Resolve: "resolve",
} as const;

there would be also support to detect the following as an enum too:

/** @enum /
export ( declare ) const EntryPointStrategy: {
/
*
* abcd
*/
readonly Resolve: "resolve",
};

(This is especially needed when typedoc is executed after pre-processing the .ts APIs by e.g. tsc / api-extractor to .d.ts)

There is even a "convenience variant" for cases when this is manually written:

/** @enum /
export const EntryPointStrategy: Readonly<{
/
*
* abcd
*/
Resolve: "resolve",
}>;

but that might be more annoying to detect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions