You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(types): zod example teaches the Zod 4 .issues accessor, and examples/ is type-checked (#2919) (#2939)
`ZodError.errors` was removed in Zod 4 (the repo is on 4.4.3).
`packages/types/examples/zod-validation-example.ts` read `.errors` in seven
places, so every `console.error` printed `undefined` and the last one —
`invalidButtonResult.error.errors.length` — threw `TypeError: Cannot read
properties of undefined (reading 'length')`, killing the example before its
summary. Same bug and same cause as the `objectui validate` fix in #2919.
`src/zod/README.md` documented the same dead accessor plus a Zod 3 issue shape;
both corrected against what 4.4.3 emits (`invalid_value` + `values`, and
"Invalid option: expected one of ...").
The example was invisible to CI, so the swap alone would let this rot again.
`packages/types` type-checks a project whose `include` is `["src/**/*"]`, so
`examples/` sat outside it — the `"examples"` entry in `exclude` was
belt-and-braces, and deleting it alone would have changed nothing. Examples
cannot join that project either: it is the package build (`tsc` -> `dist`) with
`rootDir: "./src"`, `composite` and `declaration`.
Added an emit-free `tsconfig.examples.json` and chained it from `type-check`.
The example now imports `../src/zod/index.zod` instead of
`../dist/zod/index.zod.js`, matching its three sibling example files, so the
check needs no prior build.
Verified the gate has teeth: restoring `.errors` fails with seven
`TS2339: Property 'errors' does not exist on type 'ZodError<...>'`.
Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments