Repository navigation
fix(codegen): extend TS7056 list for 3.1.0-beta.2 compound schemas — foundation now builds clean - #1912
Closed
bokelley wants to merge 1 commit into
Closed
fix(codegen): extend TS7056 list for 3.1.0-beta.2 compound schemas — foundation now builds clean#1912bokelley wants to merge 1 commit into
bokelley wants to merge 1 commit into
Conversation
… schemas
3.1.0-beta.2 pushed four more generated Zod schemas past TypeScript's
.d.ts serialization limit (TS7056). The existing post-processor handled
two pre-3.1 offenders via z.ZodType; extend the mechanism with
optional typed-shape annotations so the new offenders get correct
narrowing instead of falling back to `unknown`.
Changes:
- TS7056_SCHEMAS gains an optional tsType per entry; annotation
becomes z.ZodType<T, T> (Zod v4 two-type-param form) so
z.input<typeof X> resolves to the typed shape. & Record<string, unknown>
reflects runtime passthrough so callers expecting record-shaped
params keep narrowing.
- Auto-inject `import type { ... } from './tools.generated'` for the
typed schemas.
- Newly annotated: PreviewCreativeRequestSchema, UpdateMediaBuyRequestSchema,
UpdateMediaBuyResponseSchema, BuildCreativeResponseSchema,
SyncEventSourcesResponseSchema.
- One-line cast at the withOptionalAccount(UpdateMediaBuyRequestSchema)
call site to satisfy the helper's z.ZodObject<...> constraint;
runtime shape unchanged.
Result: build:lib produces dist .d.ts cleanly. The whole 8.0-beta
foundation now compiles end-to-end.
Part of the #1902 8.0-beta sweep.
Contributor
Author
Contributor
Author
|
Acknowledged — noting that this PR is superseded by #1924, with the codegen-tooling fix landing directly on Generated by Claude Code |
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.
Stacked on #1902. Closes the final compile gap — `build:lib` now produces `dist/` cleanly. With this merged, the 8.0-beta foundation compiles end-to-end (no `tsc --noEmit` errors AND no `build:lib` errors).
Problem
AdCP 3.1.0-beta.2's schema complexity pushed four more generated Zod schemas past TypeScript's `.d.ts` serialization limit (TS7056). The post-processor in `scripts/generate-zod-from-ts.ts` already handled this for `AdCPAsyncResponseDataSchema` and `MCPWebhookPayloadSchema` by appending a bare `z.ZodType` annotation — but bare `z.ZodType` makes `z.input` resolve to `unknown`, breaking `AdcpToolMap[K]['params']` narrowing.
Solution
`TS7056_SCHEMAS` entries now carry an optional `tsType` field. When present, the annotation uses the 2-type-param Zod v4 form: `z.ZodType<T, T>` with `& Record<string, unknown>` widening to reflect the runtime `.passthrough()` behavior. `z.input` resolves correctly; downstream destructures keep their field types.
Newly annotated:
Auto-injected: `import type { ... } from './tools.generated'` for the typed schemas.
One-line cast at the `withOptionalAccount(UpdateMediaBuyRequestSchema)` call site so the framework helper's `z.ZodObject<...>` constraint is satisfied — runtime shape unchanged.
Verification
Adopter migration
None — purely codegen-tooling. The runtime schemas are identical; only the static `.d.ts` annotations changed.
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]