Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
TL;DR — Makes Key changes
Summary | 11 files | 15 commits | base:
|
| API | Import responsibility |
|---|---|
new Integration({ typescript, ... }) |
Caller imports and passes typescript |
await Integration.create({ ... }) |
Class dynamically imports it |
zod-sockets/src/integration.ts · zod-sockets/package.json · CHANGELOG.md
Zod-to-TS producers receive api via context
Before: Producer functions in
zts.tsaccessedts,f, and helpers likeensureTypeNode/makeUnionthrough module-level imports.
After: TheZTSContextinterface gains anapi: TypescriptAPIfield. Every producer destructures{ api }from context and calls methods on it.
This eliminates the runtime dependency on the top-level typescript import across the entire Zod-to-TS transformation pipeline. The onPrimitive factory switches from passing ts.SyntaxKind enum values directly to passing string literal keys (e.g. "StringKeyword") resolved at call time via api.ts.SyntaxKind. The samples lookup in onPipeline was moved inside the function body since it now depends on the api instance.
How does the loose record change work?
onRecordnow checksdef.mode === "loose"and, when true, wraps the output asRecord<K, V> & Record<PropertyKey, V>usingcreateIntersectionTypeNode. This accurately represents that a loosez.record()accepts keys beyond those explicitly enumerated.
zod-sockets/src/zts.ts · zod-sockets/src/zts-helpers.ts · zod-sockets/src/zts.spec.ts
There was a problem hiding this comment.
Clean refactor. The core idea — making typescript an injected dependency via the TypescriptAPI class — is well-executed. The create() static factory for dynamic import is a nice convenience alongside the explicit constructor. Two minor observations below.
Task list (7/7 completed)
- Read full diff and identify major areas of change
- Deep-dive into typescript-api.ts changes (largest file)
- Review zts.ts changes (second largest)
- Review integration.ts changes
- Review package.json, helpers, tests, docs
- Impact analysis for breaking changes
- Submit review
|
No code changes needed — the author acknowledged the Task list (3/3 completed)
|
|
No action needed — both review threads are already addressed. The author removed the unused Task list (3/3 completed)
|

This reduces memory usage