Skip to content

fix(core): infer s.any() fields as any - #390

Merged
Railly merged 2 commits into
mainfrom
railly/schema-any-infer
Oct 12, 2026
Merged

Railly merged 2 commits into
mainfrom
railly/schema-any-infer

Conversation

@Railly

@Railly Railly commented Oct 7, 2026

Copy link
Copy Markdown
Member

InferSpecField mapped SchemaType<"any"> to unknown, so the data returned by catalog.validate() was not assignable to Spec whenever the schema had a field like visible: s.any(). Callers needed an as unknown as Spec cast. It now infers as any, matching z.any().

Adds a test in schema.test.ts that assigns validated data to Spec. It fails tsc without the fix.

Fixes #251. Recreates #254 by @tmchow, credited as co-author.

InferSpecField mapped SchemaType<"any"> to unknown, so catalog.validate() data with a visible: s.any() field was not assignable to Spec and needed an as unknown as Spec cast.

Co-Authored-By: Trevin Chow <trevin@trevinchow.com>
@vercel

vercel Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
json-render Ready Ready Preview, v0 Oct 10, 2026 11:09pm UTC
json-render-chat-demo Ready Ready Preview, v0 Oct 10, 2026 11:09pm UTC
json-render-dashboard-demo Ready Ready Preview, v0 Oct 10, 2026 11:09pm UTC
json-render-game-engine-demo Ready Ready Preview, v0 Oct 10, 2026 11:09pm UTC
json-render-image-demo Ready Ready Preview, v0 Oct 10, 2026 11:09pm UTC
json-render-no-ai Ready Ready Preview, v0 Oct 10, 2026 11:09pm UTC
json-render-react-email-demo Ready Ready Preview, v0 Oct 10, 2026 11:09pm UTC
json-render-react-pdf-demo Ready Ready Preview, v0 Oct 10, 2026 11:09pm UTC
json-render-react-three-fiber-demo Ready Ready Preview, v0 Oct 10, 2026 11:09pm UTC
json-render-remotion-demo Ready Ready Preview, v0 Oct 10, 2026 11:09pm UTC
json-render-solid-demo Ready Ready Preview, v0 Oct 10, 2026 11:09pm UTC
json-render-svelte-chat-demo Ready Ready Preview, v0 Oct 10, 2026 11:09pm UTC
json-render-svelte-demo Ready Ready Preview, v0 Oct 10, 2026 11:09pm UTC
json-render-vue Ready Ready Preview, v0 Oct 10, 2026 11:09pm UTC

Comment thread packages/core/src/schema.test.ts
core had no check-types script, so turbo skipped it and reverting the s.any() inference fix still passed CI. A focused tsconfig checks src/schema.test.ts; the full core project still fails tsc on main (TS6059, test-only errors).
@Railly
Railly merged commit 5473fe1 into main Oct 12, 2026
25 checks passed
@ctate ctate mentioned this pull request Oct 13, 2026

This branch was successfully deployed

14 active deployments
Preview – json-render-svelte-chat-demo — 3ea6b539 Deployed Oct 10, 2026 by vercel[bot]
Preview – json-render — 3ea6b539 Deployed Oct 10, 2026 by vercel[bot]
Preview – json-render-no-ai — 3ea6b539 Deployed Oct 10, 2026 by vercel[bot]
Preview – json-render-chat-demo — 3ea6b539 Deployed Oct 10, 2026 by vercel[bot]
Preview – json-render-remotion-demo — 3ea6b539 Deployed Oct 10, 2026 by vercel[bot]
Preview – json-render-game-engine-demo — 3ea6b539 Deployed Oct 10, 2026 by vercel[bot]
Preview – json-render-dashboard-demo — 3ea6b539 Deployed Oct 10, 2026 by vercel[bot]
Preview – json-render-react-three-fiber-demo — 3ea6b539 Deployed Oct 10, 2026 by vercel[bot]
Preview – json-render-react-pdf-demo — 3ea6b539 Deployed Oct 10, 2026 by vercel[bot]
Preview – json-render-vue — 3ea6b539 Deployed Oct 10, 2026 by vercel[bot]
Preview – json-render-react-email-demo — 3ea6b539 Deployed Oct 10, 2026 by vercel[bot]
Preview – json-render-image-demo — 3ea6b539 Deployed Oct 10, 2026 by vercel[bot]
Preview – json-render-svelte-demo — 3ea6b539 Deployed Oct 10, 2026 by vercel[bot]
Preview – json-render-solid-demo — 3ea6b539 Deployed Oct 10, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

catalog.validate() return type incompatible with Spec due to visible: s.any() in React schema

2 participants