From f6348a5da678d1b3246011ed14b6fa4d49917e33 Mon Sep 17 00:00:00 2001 From: ledouxm Date: Mon, 1 Apr 2024 17:46:41 +0200 Subject: [PATCH] feat(Link): add LinkProps option --- src/link.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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 };