From 077cf78d30ef2e87071cace8184e6d83a8ea1b8c Mon Sep 17 00:00:00 2001 From: Joni Vainio-Kaila Date: Wed, 4 Mar 2026 08:07:36 +0200 Subject: [PATCH] feat(package): Export LinkProps, FormProps and HrefOptions types --- package/src/router/client/index.ts | 6 ++++++ package/src/router/shared/FormFactory.tsx | 2 +- package/src/router/shared/LinkFactory.tsx | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/package/src/router/client/index.ts b/package/src/router/client/index.ts index f4da41d..9cd8611 100644 --- a/package/src/router/client/index.ts +++ b/package/src/router/client/index.ts @@ -45,6 +45,8 @@ export type Config = UserConfig; */ export const useHref = useHrefFactory(useLocale, useSchema); +export type { HrefOptions } from "../shared/useHrefFactory"; + /** * Hook that returns the current route pathname. * @@ -63,6 +65,8 @@ export const useRoute = useRouteFactory(useSchema); */ export const Link = LinkFactory(useHref); +export type { LinkProps } from "../shared/LinkFactory"; + /** * Form component with localized routing support. * @@ -72,6 +76,8 @@ export const Link = LinkFactory(useHref); */ export const Form = FormFactory(useHref); +export type { FormProps } from "../shared/FormFactory"; + /** * Hook for accessing and formatting localized messages. * diff --git a/package/src/router/shared/FormFactory.tsx b/package/src/router/shared/FormFactory.tsx index 3a55cc8..73c3424 100644 --- a/package/src/router/shared/FormFactory.tsx +++ b/package/src/router/shared/FormFactory.tsx @@ -8,7 +8,7 @@ import { type NextFormProps = ComponentProps<"form">; -type FormProps = Omit & +export type FormProps = Omit & ({ action: | R diff --git a/package/src/router/shared/LinkFactory.tsx b/package/src/router/shared/LinkFactory.tsx index fc1fd07..37e23af 100644 --- a/package/src/router/shared/LinkFactory.tsx +++ b/package/src/router/shared/LinkFactory.tsx @@ -11,7 +11,7 @@ import { type NextLinkProps = ComponentProps; -type LinkProps = Omit & +export type LinkProps = Omit & ( | { href: HrefOptions; locale?: undefined; params?: undefined } | ({ href: R | (string & {}); locale?: Locale } & ParamsOption)