Skip to content

fix(core): infer s.any() as any instead of unknown in validate return type#254

Open
tmchow wants to merge 1 commit intovercel-labs:mainfrom
tmchow:osc/251-fix-validate-return-type
Open

fix(core): infer s.any() as any instead of unknown in validate return type#254
tmchow wants to merge 1 commit intovercel-labs:mainfrom
tmchow:osc/251-fix-validate-return-type

Conversation

@tmchow
Copy link
Copy Markdown

@tmchow tmchow commented Apr 2, 2026

Summary

InferSpecField mapped SchemaType<"any"> to unknown, making catalog.validate() return types incompatible with Spec. Fields like visible: s.any() produced visible: unknown instead of visible: any, forcing as unknown as Spec casts.

Changes

packages/core/src/schema.ts: Changed the InferSpecField conditional type to map SchemaType<"any"> to any instead of unknown. This matches how Zod's z.any() infers and makes the validated spec directly assignable to Spec.

Testing

All 892 existing tests pass. pnpm type-check passes.

Fixes #251

This contribution was developed with AI assistance (Codex).

… type

InferSpecField mapped SchemaType<"any"> to unknown, which made
catalog.validate() return types incompatible with Spec. Fields
like visible: s.any() produced visible: unknown instead of
visible: any, forcing as-casts. Now maps to any, matching Zod's
z.any() behavior.

Fixes vercel-labs#251
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 2, 2026

@tmchow is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

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

1 participant