Skip to content

docs: update keyof() ZodEnum type to the v4 form#6124

Open
patrickwehbe wants to merge 1 commit into
colinhacks:mainfrom
patrickwehbe:keyof-zodenum-v4-type
Open

docs: update keyof() ZodEnum type to the v4 form#6124
patrickwehbe wants to merge 1 commit into
colinhacks:mainfrom
patrickwehbe:keyof-zodenum-v4-type

Conversation

@patrickwehbe

Copy link
Copy Markdown

The .keyof() examples show the result type as ZodEnum<["name", "age"]>, which is the Zod 3 form where ZodEnum's parameter was a string tuple.

In Zod 4 ZodEnum takes an enum-like object instead (EnumLike = Readonly<Record<string, EnumValue>>), and keyof() returns ZodEnum<util.ToEnum<keyof Shape & string>>. For Dog with keys name and age that resolves to ZodEnum<{ name: "name"; age: "age" }>, so this updates both the Zod and Zod Mini examples to match.

Docs-only change.

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