Skip to content

feat!: enum of 1 is a literal#466

Merged
mnahkies merged 1 commit into
mainfrom
mn/feat/literals
May 17, 2026
Merged

feat!: enum of 1 is a literal#466
mnahkies merged 1 commit into
mainfrom
mn/feat/literals

Conversation

@mnahkies
Copy link
Copy Markdown
Owner

treat enums with a single valid value as closed by default, and use z.literal.

this is often the case with discriminated unions, and the open by default behavior in clients isn't desirable in this scenario.

it's still possible to override this behavior, in situations where you do intend to later add more values to the enum.

@mnahkies mnahkies force-pushed the mn/feat/literals branch from 6e295b9 to 2656a4a Compare May 17, 2026 12:59
@mnahkies mnahkies changed the title feat: enum of 1 is a literal feat!: enum of 1 is a literal May 17, 2026
@mnahkies mnahkies marked this pull request as ready for review May 17, 2026 12:59
@mnahkies mnahkies enabled auto-merge (squash) May 17, 2026 12:59
@mnahkies mnahkies merged commit 49683d4 into main May 17, 2026
16 checks passed
@mnahkies mnahkies deleted the mn/feat/literals branch May 17, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant