这是indexloc提供的服务,不要输入任何密码
Skip to content

Support generating const enum #2540

@ixnas

Description

@ixnas

Description

I'd like to be able to generate enums as const enum. In use, it's equivalent to regular TypeScript enums, but it won't generate any runtime code. Instead, it will inline its values into the JavaScript code.

I saw on the discussion board that there's at least one other person interested in this feature 😄

I'd suggest being able to configure it like so:

{
  name: '@hey-api/typescript', // preserves default output
  enums: 'typescript-const',
},

What do you think? I'm willing to attempt to implement this myself and make a PR for it!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions