#Adding Strongly Typed Link Options to Component

2 messages · Page 1 of 1 (latest)

main hound
#

I am building a breadcrumb component that I want to pass a strongly typed version of the link in, I have the params for this component defined as:

export interface BreadcrumbParams {   
    homeLink: LinkPropsOptions;
    pages: BreadcrumbPage[];
}

So it is working when I do things like this:

   var breadCrumbParams: BreadcrumbParams = {
      homeLink: { to: '/$account_id/home', params: { account_id: account_id }},
      pages: []
    };
  

But what is not erroring on is if I didn't include the params on the homeLink, how can I make that required like the standard Link does?

upbeat veldt
#

I was just trying to figure out the same thing! So for those seeing this in the future...

Besides what docs mention (like using linkOptions, or making a custom link component), It appears that if you just use the LinkComponentProps type, it seems to do the trick.