`"zod": "*"` in `peerDependencies` resolves Zod 4, causing `import "@tscircuit/props"` to throw `z.function(...).args is not a function`

Open Beginner friendly
#1,016 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
Under an hour
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, typescript
Domain
build-system

Research direction

Start in package.json: compare the peerDependencies range for zod with the "zod": "3" in devDependencies, and with the ranges used by @tscircuit/circuit-json-util and @tscircuit/modelprinter. Confirm the failing call site is z.function().args(...) in lib/platformConfig.ts, then tighten the peer range to Zod 3 (issue suggests "3" or "^3.25.67"). Done means the repro script in the issue installs Zod 3 in a fresh directory and resistorProps.parse({ name: "R1", resistance: "10k" }) prints the parsed object; leave Zod 4 support to #752.

Written by the indexing model from the issue text.

Description

@tscircuit/props builds against "zod": "3" (devDependencies) and uses Zod 3's z.function().args(...) in lib/platformConfig.ts, which was removed in Zod 4, but package.json declares "zod": "*" in peerDependencies so npm installs [email protected] by default (and accepts an existing [email protected] without warning).

mkdir repro && cd repro
echo '{"type":"module"}' > package.json
npm install @tscircuit/[email protected]
node -e 'import { resistorProps } from "@tscircuit/props"; console.log(resistorProps.parse({ name: "R1", resistance: "10k" }))'

Actual (npm ls zod resolves [email protected] at the top level):

file:///.../repro/node_modules/@tscircuit/props/dist/index.js:20908
var pathToCircuitJsonFn = z191.function().args(z191.string()).returns(z191.promise(footprintLibraryResult)).or(
                                          ^

TypeError: z191.function(...).args is not a function

Expected: peerDependencies.zod is constrained to Zod 3 (for example "3" or "^3.25.67", matching @tscircuit/circuit-json-util and @tscircuit/modelprinter) until Zod 4 support (#752) lands, so npm install @tscircuit/props installs a compatible Zod 3 release and prints { name: 'R1', resistance: 10000 }.

Versions: @tscircuit/[email protected] (npm latest) and main (9068416c4), [email protected], Node.js v26.13.0, npm 11.20.0.

Credit: https://ucsbplse.github.io/

Dominant language
TypeScript
Stars
6
Forks
66
Avg merge
1d 11h
Merged PRs (30d)
31

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.