Closed branikclimbs closed 1 year ago
I am getting this error when I use my custom Link component Type 'string' is not assignable to type 'Route | Query' but It works with default Link component from next js. I am doing something wrong?
Type 'string' is not assignable to type 'Route | Query'
this is my custom Link component
import NextLink, { LinkProps as NextLinkProps } from 'next/link' export type LinkProps = Omit<NextLinkProps, 'passHref' | 'as'> & Omit<ChakraLinkProps, 'href'> export const Link: React.FC<React.PropsWithChildren<LinkProps>> = ({ children, href, onClick, className, replace, scroll, shallow, prefetch, locale, ...props }) => { return ( <NextLink href={href} legacyBehavior passHref> <ChakraLink {...props}>{children}</ChakraLink> </NextLink> ) }
When I use it like this I will get error I mentioned above but when I import Link from next js everything works as expected.
<Link href="/users">text</Link>
Thanks for reporting this @branislaav. This is fixed in 1.0.4
I am getting this error when I use my custom Link component
Type 'string' is not assignable to type 'Route | Query'
but It works with default Link component from next js. I am doing something wrong?this is my custom Link component
When I use it like this I will get error I mentioned above but when I import Link from next js everything works as expected.