Skip to content

Restore "Writing generic functions" section in docs (add to basics page)#6061

Open
pullfrog[bot] wants to merge 1 commit into
mainfrom
pullfrog/6060-generic-functions-docs
Open

Restore "Writing generic functions" section in docs (add to basics page)#6061
pullfrog[bot] wants to merge 1 commit into
mainfrom
pullfrog/6060-generic-functions-docs

Conversation

@pullfrog

@pullfrog pullfrog Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

The old Zod 3 docs had a "Writing generic functions" section that showed users how to accept Zod schemas as function parameters. The Zod 4 docs have equivalent (and better) content in /library-authors, but that page is explicitly scoped to library authors — a general user wouldn't think to look there.

This adds a concise "Writing generic functions" section to the basics page covering:

  • The correct generic pattern (T extends z.ZodType not z.ZodType<T>)
  • Extracting the inferred type with z.output<T>
  • Constraining allowable input types

A cross-reference to /library-authors points users to the full treatment for advanced patterns (Zod Mini, Zod 3/4 dual-support).

Closes #6060

Pullfrog  | View workflow run | via Pullfrog | Using DeepSeek Pro𝕏

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.

Restore section on Zod schemas as parameters in the docs

0 participants