T
TanStack9mo ago
multiple-amethyst

Store links in an array

I'm trying to define a long list of links in an array for an onboarding flow so that I'm able to programmatically define a layout where you have the navigation to the left (list of links in order) and so that the layout automatically provides "previous" and "next" buttons for each step of the flow. Is there a way to type:
const links: MysteryType = [
{ to: "/$lang/onboarding/a", params: { lang }},
{ to: "/$lang/onboarding/b", params: { lang }},
// ...
];
const links: MysteryType = [
{ to: "/$lang/onboarding/a", params: { lang }},
{ to: "/$lang/onboarding/b", params: { lang }},
// ...
];
and have it be typesafe? I tried to use LinkProps but it seems to lose typesafety when used directly.
1 Reply
multiple-amethyst
multiple-amethystOP9mo ago
I've found another way by using router.buildLocation instead.

Did you find this page helpful?