T
TanStack2y ago
rival-black

Path is not types safe

redirect fn doesn't produce any error if you pass path which is not in router with type string
const t: string = "bla";

redirect({to: t});
const t: string = "bla";

redirect({to: t});
6 Replies
afraid-scarlet
afraid-scarlet2y ago
not sure I get the problem you can either pass in a const string literal, or a string if you pass in a string, you lose the typesafety
rival-black
rival-blackOP2y ago
@Manuel Schiller So ability to receive any string type is design solution?
afraid-scarlet
afraid-scarlet2y ago
yes you can use it, but you don't have to see it as kind of an escape hatch for specific situations
rival-black
rival-blackOP2y ago
I'm used to keep all my routes as constants
afraid-scarlet
afraid-scarlet2y ago
then do that
rival-black
rival-blackOP2y ago
got it. thanks

Did you find this page helpful?