From 493f518caabcba0e8e593f1e4091b5f2d58d1554 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 20808f0..f9bb2ab 100644 --- a/package/src/router/shared/FormFactory.tsx +++ b/package/src/router/shared/FormFactory.tsx @@ -9,7 +9,7 @@ import { type NextFormProps = ComponentProps; -type FormProps = Omit & +export type FormProps = Omit & ({ action: R | Exclude | (string & {}); locale?: Locale; diff --git a/package/src/router/shared/LinkFactory.tsx b/package/src/router/shared/LinkFactory.tsx index 2d214f1..d33ac71 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)