Is this use of FileRouteTypes['to'] valid?
Hello,
I'm using a
Link
component and the to
prop is dynamic. I get the value of the to
prop by calling my getConfigureModeLink
function.
To ensure the function can only return a valid registered route I have typed it's return type as FileRouteTypes['to']
which is the interface exported from routeTree.gen.ts
.
My Link component:
The getConfigureModeLink
function:
Question
This works fine. What I would like to know is:
Is this how I should be typing a variable to ensure it is a valid route or is there a more conventional approach?
Thank You.0 Replies