TanStackT
TanStack15mo ago
12 replies
popular-magenta

npx tsr doesn't generate `index.ts` route

I've followed the TanStack Start guide, and I'm about to create the second route in addition to __root.tsx, namely the index.ts route. When Vinxi is running, when I create the index.ts file, it is automatically populated with the following:
import * as React from 'react'
import { createFileRoute } from '@tanstack/react-router'

export const Route = createFileRoute('/')({
  component: RouteComponent,
})

function RouteComponent() {
  return 'Hello /!'
}


Lovely!! However, I noticed inside routeTree.gen.ts that FileRoutesById is not populated with my index route.
export interface FileRoutesById {
  __root__: typeof rootRoute
}

I imagine this is why I get Argument of type 'string' is not assignable to parameter of type 'never'. on the createFileRoute invocation in index.ts.

I tried installing @tanstack/router-cli and running npx tsr to try to generate the missing definition for index.ts, but had no luck.
Was this page helpful?