Which project does this relate to?
Start
Describe the bug
When using createServerFn with method: 'GET' and a .validator(), the data parameter inside the .handler() callback is not correctly typed from the validator's output — it falls back to undefined instead of the expected inferred type.
This is a regression introduced in @tanstack/react-start@1.168.24.
Reproduction
import { createServerFn } from '@tanstack/react-start'
import { z } from 'zod'
const schema = z.object({ id: z.string() })
const myFn = createServerFn({ method: 'GET' })
.validator(schema)
.handler((ctx) => {
// ❌ ctx.data is typed as `unknown` instead of `{ id: string }`
console.log(ctx.data.id)
})
The same pattern works correctly with method: 'POST', or worked correctly with method: 'GET' prior to version 1.168.24.
Package version
@tanstack/react-start: 1.168.24
Complete minimal reproducer
SEE DESCRIBE
Steps to Reproduce the Bug
- Create a server function with
method: 'GET'
- Chain
.validator() with any validator (zod schema, function)
- Access
ctx.data inside .handler() — TypeScript reports the type as unknown
Expected behavior
ctx.data should be typed as { id: string } (i.e., the output type inferred from the validator).
Screenshots or Videos
Platform
- Router / Start Version: 1.168.24
- OS: windows
- Browser: Edge
- Browser Version: 149.0.4022.69
- Bundler: vite
- Bundler Version: 8.0.16
Additional context
No response
Which project does this relate to?
Start
Describe the bug
When using
createServerFnwithmethod: 'GET'and a.validator(), thedataparameter inside the.handler()callback is not correctly typed from the validator's output — it falls back toundefinedinstead of the expected inferred type.This is a regression introduced in
@tanstack/react-start@1.168.24.Reproduction
The same pattern works correctly with
method: 'POST', or worked correctly withmethod: 'GET'prior to version1.168.24.Package version
@tanstack/react-start:1.168.24Complete minimal reproducer
SEE DESCRIBE
Steps to Reproduce the Bug
method: 'GET'.validator()with any validator (zod schema, function)ctx.datainside.handler()— TypeScript reports the type asunknownExpected behavior
ctx.datashould be typed as{ id: string }(i.e., the output type inferred from the validator).Screenshots or Videos
Platform
Additional context
No response