Closed McManning closed 1 year ago
Ran into this with NextJS - if I try to polymorph one of our links into a NextJS link it fails miserably.
The reason was because NextJS links declare their own "as" prop which conflicts with our own. I can work around this with the following solution:
import { Group, Link } from "@osuresearch/ui"; import { default as NextLink, LinkProps } from "next/link"; type NextLinkType = React.ElementType<Omit<LinkProps, 'as'>>; export function Navbar() { return ( <Group bgc="light" p="md" gap="md"> <Link<NextLinkType> as={NextLink} >Home</Link> <Link<NextLinkType> as={NextLink} href="/evaluate">Submit an evaluation</Link> <Link<NextLinkType> as={NextLink} href="/unresolved">Unresolved issues</Link> <Link<NextLinkType> as={NextLink} href="/reporting">Reporting</Link> </Group> ) }
But a better solution would be to ensure that whatever type we're polymorphing into will always omit its own "as" prop.
:tada: This issue has been resolved in version 5.0.0-alpha.22 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Ran into this with NextJS - if I try to polymorph one of our links into a NextJS link it fails miserably.
The reason was because NextJS links declare their own "as" prop which conflicts with our own. I can work around this with the following solution:
But a better solution would be to ensure that whatever type we're polymorphing into will always omit its own "as" prop.