diff --git a/src/link.tsx b/src/link.tsx index fd634c2d..dc52da25 100644 --- a/src/link.tsx +++ b/src/link.tsx @@ -3,6 +3,7 @@ import { fr } from "./fr"; import { cx } from "./tools/cx"; import { assert } from "tsafe/assert"; import { is } from "tsafe/is"; +import type { UnpackProps } from "./tools/UnpackProps"; type HTMLAnchorProps = DetailedHTMLProps< AnchorHTMLAttributes, @@ -12,10 +13,8 @@ type HTMLAnchorProps = DetailedHTMLProps< // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface RegisterLink {} -export type RegisteredLinkProps = RegisterLink extends { - Link: (props: infer LinkProps) => any; -} - ? Omit +export type RegisteredLinkProps = RegisterLink extends { Link: infer Link } + ? Omit, "children"> : Omit; let Link: ( diff --git a/src/tools/UnpackProps.ts b/src/tools/UnpackProps.ts new file mode 100644 index 00000000..6617ed0e --- /dev/null +++ b/src/tools/UnpackProps.ts @@ -0,0 +1 @@ +export type UnpackProps = T extends React.ComponentType ? P : never;