Skip to content

fix(core,shadcn-svelte): make zod a peer-only dependency - #303

Closed
ctate wants to merge 1 commit into
mainfrom
fix/zod-peer-dep-297
Closed

fix(core,shadcn-svelte): make zod a peer-only dependency#303
ctate wants to merge 1 commit into
mainfrom
fix/zod-peer-dep-297

Conversation

@ctate

@ctate ctate commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #297.

@json-render/core and @json-render/shadcn-svelte listed zod in both dependencies (^4.3.6) and peerDependencies (^4.0.0). Package managers can resolve the dependencies entry to a second zod copy distinct from the consumer's (e.g. a lockfile that pinned 4.3.x while the app uses 4.4.x). zod v4 intentionally embeds a version literal in its types (_zod.version.minor), so two copies are structurally incompatible and consumers hit:

The types of 'props._zod.version.minor' are incompatible between these types.
  Type '4' is not assignable to type '3'.

plus type instantiation is excessively deep errors and tsc memory blowups from the cross-copy structural comparison.

Fix

Move zod to devDependencies in both packages, keeping the ^4.0.0 peer range. The consumer's zod is then always the only copy.

Verification

  • Reproduced Support zod 4.4+ — _zod.version.minor type check prevents upgrade #297 exactly against published @json-render/solid@0.19.0 with zod@4.4.3 and a nested 4.3.6 copy under core (same error text as the issue).
  • Rebuilt core + solid from this branch, packed with pnpm pack, installed in fresh npm and pnpm consumers with zod@4.4.3: one zod resolved (pnpm why zod → "Found 1 version"), the issue's repro (schema.createCatalog + registry) typechecks cleanly.
  • Workspace: all packages build and all 1021 unit tests pass with zod resolved to 4.3.6 and (via a temporary override) 4.4.3.

zod was listed in both dependencies (^4.3.6) and peerDependencies
(^4.0.0) in @json-render/core and @json-render/shadcn-svelte. Package
managers can resolve the dependencies entry to a second zod copy
distinct from the consumer's (e.g. a lockfile that pinned 4.3.x while
the app uses 4.4.x). zod v4 intentionally embeds a version literal in
its types (_zod.version.minor), so two copies are structurally
incompatible and consumers hit:

  The types of 'props._zod.version.minor' are incompatible.
    Type '4' is not assignable to type '3'.

plus 'type instantiation is excessively deep' errors and tsc memory
blowups from the cross-copy structural comparison.

Moving zod to devDependencies (keeping the ^4.0.0 peer range) means the
consumer's zod is always the only copy. Verified with npm and pnpm
consumers on zod 4.4.3: one zod resolved, repro from #297 typechecks.
Workspace builds and all 1021 unit tests pass under zod 4.3.6 and 4.4.3.

Fixes #297
@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
json-render Ready Ready Preview, Comment Jul 1, 2026 11:56pm
json-render-chat-demo Error Error Jul 1, 2026 11:56pm
json-render-dashboard-demo Ready Ready Preview, Comment Jul 1, 2026 11:56pm
json-render-game-engine-demo Error Error Jul 1, 2026 11:56pm
json-render-image-demo Ready Ready Preview, Comment Jul 1, 2026 11:56pm
json-render-no-ai Error Error Jul 1, 2026 11:56pm
json-render-react-email-demo Ready Ready Preview, Comment Jul 1, 2026 11:56pm
json-render-react-pdf-demo Ready Ready Preview, Comment Jul 1, 2026 11:56pm
json-render-react-three-fiber-demo Ready Ready Preview, Comment Jul 1, 2026 11:56pm
json-render-remotion-demo Ready Ready Preview, Comment Jul 1, 2026 11:56pm
json-render-solid-demo Ready Ready Preview, Comment Jul 1, 2026 11:56pm
json-render-svelte-chat-demo Ready Ready Preview, Comment Jul 1, 2026 11:56pm
json-render-svelte-demo Ready Ready Preview, Comment Jul 1, 2026 11:56pm
json-render-vue Ready Ready Preview, Comment Jul 1, 2026 11:56pm

Comment thread pnpm-lock.yaml
zod:
specifier: ^4.3.6
version: 4.3.6
version: 4.4.3

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two coexisting zod 4.x copies (4.3.6 and 4.4.3) in the lockfile cause next build type errors in the example apps because app-authored z.object(...) schemas and workspace catalog types resolve to different zod instances.

Fix on Vercel

@ctate ctate closed this Sep 1, 2026
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.

Support zod 4.4+ — _zod.version.minor type check prevents upgrade

1 participant