Skip to content

[Typescript] Enum types (#18531)#23921

Merged
wing328 merged 2 commits into
masterfrom
ts-enumtype
Jun 2, 2026
Merged

[Typescript] Enum types (#18531)#23921
wing328 merged 2 commits into
masterfrom
ts-enumtype

Conversation

@wing328

@wing328 wing328 commented Jun 2, 2026

Copy link
Copy Markdown
Member

based on #18531 (originally targeting 8.0.x branch)


Summary by cubic

Adds a new enumType option to the TypeScript client generator to choose between TypeScript enums and string literal unions. Default remains enum for compatibility; consolidated TypeScript configs now use stringUnion.

  • New Features

    • New CLI/config option enumType with values enum (default) or stringUnion.
    • Templates updated to emit export enum or export type Foo = "a" | "b".
    • Docs updated; consolidated TS sample configs set enumType: stringUnion; tests adjusted, including a case with no option set to verify the default.
  • Migration

    • No changes needed if you rely on export enum (default).
    • To use union types, set additionalProperties.enumType=stringUnion and update usages from Enum.Member to string literals (e.g., 'available').

Written for commit 2307594. Summary will update on new commits.

Review in cubic

ksvirkou-hubspot and others added 2 commits June 2, 2026 11:16
* Add enum type generator argument

* Generate tests

* fix default sample test

* Fix all typescript tests

* Update docs

* Added description for enum types

* Set enum type as default

* Set addition param for all tests except
@wing328 wing328 added this to the 7.23.0 milestone Jun 2, 2026
@wing328 wing328 marked this pull request as ready for review June 2, 2026 03:52
@wing328 wing328 merged commit 1dc89bd into master Jun 2, 2026
49 of 51 checks passed
@wing328 wing328 deleted the ts-enumtype branch June 2, 2026 03:53
@wing328 wing328 mentioned this pull request Jun 2, 2026
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants