typescript error for dynamic route
Hello, I am using this Link component that goes to a dynamic route: /dashboard/transactions/$transactionId where a transactionId is passed in using interpolation, see the image below.
Typescript is giving me an error in Webstorm where I really think it should work just fine. Anyone know what's going on here and/or how to resolve this?

3 Replies
helpful-purple•3mo ago
don't interpolate the path param yourself
pass in params as a prop
harsh-harlequinOP•3mo ago
ahh rats, I should've known this.
Changed it to:
<Link
to={"/dashboard/transactions/$transactionId"}
params={{ transactionId: transaction.id.toString() }}
...>
and the error went away.
Curiously though, the error was only in the IDE. The app still worked as expected and also built without errors.
helpful-purple•3mo ago
yes it works but it is not typesafe