Repository navigation
Description
Describe the bug
@tanstack/react-form-start's types for serverValidate don't match @tanstack/react-form-nextjs. Runtime behavior isn't affected (both parse rememberMe as a boolean).
In Start:
import { createServerValidate as createStartServerValidate } from "@tanstack/react-form-start";
const startServerValidate = createStartServerValidate({
onServerValidate: Validator,
});
await startServerValidate(new FormData(), {
booleans: ["rememberMe"], // Error
// ^ Object literal may only specify known properties, and 'booleans' does not exist in type 'FormDataTransform'., a
});In Next.js:
import { createServerValidate as createNextServerValidate } from "@tanstack/react-form-nextjs";
const nextServerValidate = createNextServerValidate({
onServerValidate: Validator
});
await nextServerValidate(new FormData(), {
booleans: ["rememberMe"], // No error!
});Your minimal, reproducible example
Steps to reproduce
- Install
@tanstack/react-form-startand@tanstack/react-form-nextjsand a validator (Zod in the example, or use the TypeScript playground) - Create a server validate using the same validator in both
- Call the validate, passing blank FormData and an object containing
booleans(or any other key) for both - See the error in Start, but not in Next
Expected behavior
Both should either include { booleans, dates, arrays, files, numbers } as string[]s like in the Next adapter, or not include them.
How often does this bug happen?
Every time
Screenshots or Videos
Platform
- OS: Linux
- Browser: Zen Browser (Firefox)
- Browser version: 1.21.6b (Firefox 152.0.5)
TanStack Form adapter
react-form
TanStack Form version
1.33.1
TypeScript version
6.0.3
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels
Activity
fix(react-form-start): align createServerValidate info param with Nex… (