Sign in
Log inSign up
Sam Sycamore

56 likes

·

12.1K reads

5 comments

Andrew Jackson
Andrew Jackson
May 5, 2022

Hey thank you for this .. very helpful. I am having trouble with the Link.tsx file though.

…interestingly I have followed your instructions in the past with no issue. This time round something has changed I am am not certain what.

interface NextLinkComposedProps
Interface 'NextLinkComposedProps' cannot simultaneously extend types 'Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "href">' and 'Omit<InternalLinkProps, "href" | "as">'.
  Named property 'onClick' of types 'Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "href">' and 'Omit<InternalLinkProps, "href" | "as">' are not identical.ts(2320)
1
·
·3 replies
Pyry
Pyry
May 9, 2022

Hi,

I was able to work past this by omitting the events with on${string}:

interface NextLinkComposedProps
  extends Omit<
      React.AnchorHTMLAttributes<HTMLAnchorElement>,
      "href" | `on${string}`
    >,
    Omit<NextLinkProps, "href" | "as"> {
  to: NextLinkProps["href"];
  linkAs?: NextLinkProps["as"];
  href?: NextLinkProps["href"];
}
·
Andrew Jackson
Andrew Jackson
May 9, 2022

Pyry

Cool, thanks for the tip.. I will give your suggestion a try.

·
Sam Sycamore
Sam Sycamore
Author
·Sep 25, 2022

Hey Andrew Jackson! Are you still having this problem? Did the workaround above help?

I have not been able to recreate your issue. What version of React / Next / Material UI are you using?

·
Dev Sirius
Dev Sirius
Jan 4, 2023

It is awesom and very helpful

·