Repository navigation
fix: raise zod floor to 4.5.0 to match emitted declarations - #96
Merged
Merged
Conversation
The built declarations reference the two-argument ZodPreprocess type, which zod 4.3.x does not export and zod 4.4.x declares with one type parameter. Consumers resolving zod below 4.5.0 with skipLibCheck disabled failed to type-check this package. Add a test:zod-floor script, run in CI after the build, that packs the package, installs the floor zod in a scratch consumer, and type-checks it under bundler and NodeNext resolution. Closes #95
npm 10 runs the prepare script during pack despite --ignore-scripts, so its output ended up in the tarball name read from stdout and failed the Node 22 job.
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
The built declarations reference
z.ZodPreprocess<B, unknown>(fromWebAuthnRegisterStartQuerySchema), butpackage.jsonallowedzod: ^4.3.6. zod 4.3.x does not exportZodPreprocessand zod 4.4.x declares it with one type parameter, so a consumer resolving either withskipLibCheck: falsefailed to type-check this package. This raises the floor to the first zod release whose types accept the emitted.d.tsfiles, and adds a CI check so the floor cannot drift below the build again.Related Issue
Closes #95
Changes
dependencies.zod:^4.3.6to^4.5.0(lockfile still resolves 4.6.5).scripts/check-zod-floor.mjs(npm run test:zod-floor): packs the package, installs it plus the exact floor zod read frompackage.jsoninto a scratch consumer, and runstscwithstrict: true, skipLibCheck: falseunder bothmoduleResolution: bundlerandNodeNext. It imports.,./roleand./role/matching.Buildon every Node leg.Bisect
Packed 0.28.0 build (built against zod 4.6.5), consumer with TypeScript 5.9.3,
strict: true,skipLibCheck: false. Each stable zod release from 4.3.6 up was installed as the only zod in the tree.has no exported member named 'ZodPreprocess'Generic type 'ZodPreprocess<B>' requires between 0 and 1 type argumentsLowest passing version: 4.5.0.
Before / after
With the old floor (
^4.3.6):With an intermediate floor of
^4.4.3(the version from the issue), the same check fails with TS2707.With the new floor (
^4.5.0):Why zod stays a dependency
Making zod a peer dependency would guarantee a single zod instance when consumers mix their own zod schemas with ours, which matters for type identity. It is not a clear win here: the package exports only schemas (no functions that take a caller's zod schema), the in-repo consumers (seamless-auth-server, seamless-cli) already resolve a single deduped zod 4.6.5, and moving to a peer changes install behavior for every consumer. That is a separate decision, so this PR only raises the floor.
Consumer impact
Consumers already on zod 4.5.0 or later see no change. A consumer pinned to zod 4.4.x or older was already broken under
skipLibCheck: false; npm will now install a nested zod 4.5+ for this package unless they upgrade, which they should. seamless-auth-server (pnpm lock at zod 4.6.5 after #216) and seamless-cli (zod^4.6.5, lock 4.6.5) both satisfy the new floor.Checklist
npm run changeset); a change tosrc/without one ships nothingnpm run typecheck,npm run lint,npm run format:check,npm test(286 passed),npm run build,npm run test:zod-floorzod@^4)