-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
Update 2025-07-16:
Nice! With the newest update from zod a new zod update coming out (hopefully) soon, fallback
is not will not be necessary anymore! 🎊 (More infos)
Discussion: #4092
Which project does this relate to?
Router (@tanstack/zod-adapter
)
Describe the bug
It appears that fallback
from @tanstack/zod-adapter
isn't ready for Zod v4.
More information about the expected behavior is in my comment below: #4322 (comment)
Steps to Reproduce the Bug or Issue
import { z } from "zod/v4";
import { fallback, zodValidator } from "@tanstack/zod-adapter";
const searchParamSchema = z.object({
test: fallback(z.string().optional(), null).default(null),
// ^ ❗ Type Error at z.string().optional()
});
Type Error:
Argument of type 'ZodOptional<ZodString>' is not assignable to parameter of type 'ZodTypeAny'.
Type 'ZodOptional<ZodString>' is missing the following properties from type 'ZodType<any, any, any>': _type, _parse, _getType, _getOrReturnCtx, and 7 more.ts(2345)
Expected behavior
Zod 4 support
stunaz, ibqn, pascalmtts, skowronks, jthomaschewski and 4 more
Metadata
Metadata
Assignees
Labels
No labels