I'm setting up a Better Auth handler in a TanStack Start application using the documented catch-all route at /api/auth/$. The route uses createFileRoute and defines GET and POST handlers inside a server property, but TypeScript reports that the server property is not allowed on the route options type. How can I configure the project or dependencies so this route is recognized correctly?
1 Answer
That code is intended for TanStack Start. This error usually means TypeScript is loading the plain TanStack Router route types instead of the Start-specific types, so createFileRoute doesn’t know about the server option. Check that you’re actually using the TanStack Start Vite plugin and that all TanStack packages are installed at compatible versions. A mismatched package can produce this exact error.
In my case, restarting the development server made the error disappear after the dependencies and generated route types were updated.

Also check your tsconfig path and module resolution settings. An alias or duplicate installation can cause TypeScript to load types from a different package version.