feat!: migrate to zod 4 (BREAKING — peer dep ^4.4.3)#6
Merged
Conversation
zod 4 internal API changes required by this migration: - _def.typeName → _def.type (lower-cased: "ZodObject" → "object" etc.) - ZodEnum and ZodNativeEnum unified under "enum" (single .options accessor) - ZodEffects / ZodPipeline collapsed into single "pipe" type (def.in / def.out) - _def.defaultValue is now a direct value (zod 3 stored a () => unknown thunk) - ZodError.errors → ZodError.issues - ZodError path may contain numeric segments — explicit String() join Public API and runtime semantics are preserved. Consumer migration is mechanical (mostly z.string().email() → z.email() at schema definition sites — outside this library's surface). All 294 tests pass under zod 4.4.3. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
zod 3 → 4 migration. Public API and runtime semantics preserved; consumer migration is mechanical (schema-definition syntax only).
Why
Required to allow
@env-kit/node-settingsto be wrapped from a zod 4 monorepo (e.g.,service-foundryADR-0002 + ADR-0010 — see spec-x-auth-foundation-prep).Internal changes
_def.typeName→_def.type(lower-cased values)Verification
node_modules/.bin/tsc --noEmit— 0 errorsvitest run— 294/294 passtsc -b tsconfig.build.json— dist builds cleanMigration guide for consumers
Bump zod to
^4.4.3. Schema syntax adjustments at consumer sites only (out of this library's surface):ZodError.errorsconsumers must rename to.issues.Test plan
🤖 Generated with Claude Code