diff --git a/src/link.tsx b/src/link.tsx index 07e7ddf92..d47a5c7cd 100644 --- a/src/link.tsx +++ b/src/link.tsx @@ -14,13 +14,17 @@ type HTMLAnchorProps = DetailedHTMLProps< export interface RegisterLink {} export type RegisteredLinkProps = RegisterLink extends { Link: infer Link } - ? - | Omit, "children"> - | (Omit & { - href: string; - }) + ? LinkPropsWithoutChildren> + : RegisterLink extends { LinkProps: infer LinkProps } + ? LinkPropsWithoutChildren : Omit; +type LinkPropsWithoutChildren = + | Omit + | (Omit & { + href: string; + }); + let Link: React.ComponentType = props => { const { href, ...rest } = props as { to?: string; href?: string };