TanStackT
TanStack2y ago
14 replies
dangerous-fuchsia

Params typed incorrectly

I've seen a few discussions about this so it feels like a common error with a few different causes. Basically, if I have a route file called e.g. routes/admin/$activityType/index.tsx, like so:
import { createFileRoute } from '@tanstack/react-router';

export const Route = createFileRoute('/admin/$activityType/')({
  parseParams: (params) => ({ activityType: params.activityType }),
  component: () => <div>...</div>,
});

...I get the error Property 'activityType' does not exist on type 'Record<never, string>'. But I can use the parameter in the page just fine, it's just a type warning.

What are some steps I should try to unpick this? I can make a new app with the same router version and I don't get the error...
Was this page helpful?