Okay, this TypeScript error indicates that your routing library (likely TanStack Router or possibly Remix, given the $requestId pattern) expects the to prop to be a specific, defined route path template, not a dynamically constructed string with the ID embedded directly.
The library generates types based on your route definitions (like /dashboard/requests/$requestId). When you use a template literal like `/dashboard/requests/${row.getValue('id') as string}`, TypeScript sees it as a generic string (specifically, of type ``/dashboard/requests/${string}). It doesn't know that this string will *at runtime* match the pattern /dashboard/requests/some-id`.
To maintain type safety and work correctly with the router's type generation, you need to provide the route template path and the parameters separately.
Solution:
Use the actual route path template in the to prop and provide the dynamic part (the ID) in a params object.
<Link
to="/dashboard/requests/$requestId" // Use the route template path
params={{
// Provide the parameter name (without the $) and its value
requestId: row.getValue('id') as string
}}
className="text-blue-900 hover:underline underline-offset-4"
>
View
</Link>
Explanation:
to="/dashboard/requests/$requestId": You tell the Link component which route definition you are linking to. This string is one of the specific literal types allowed by the to prop's type definition ("/dashboard/requests/$requestId" is listed in the error).
params={{ requestId: row.getValue('id') as string }}: You provide an object where the keys match the parameter names defined in the route path (e.g., $requestId means the param name is requestId), and the values are the dynamic data for those parameters. The router then uses this information to build the final URL path at runtime (/dashboard/requests/actual-id).
This approach allows the TypeScript types generated by your router library to correctly validate that you are linking to a known route and providing the necessary parameters with the correct keys.