From 7a4ec210fc3a9354f4c5cf6f0ba2ac9865b9dd9b Mon Sep 17 00:00:00 2001 From: sugar Date: Fri, 3 Jan 2025 21:51:03 +0100 Subject: [PATCH 1/2] Make useHref return a string with string param This avoids the need to handle an undefined value when the destination parameter is known to be a string. --- src/routing.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routing.ts b/src/routing.ts index e9ccc066..d426a931 100644 --- a/src/routing.ts +++ b/src/routing.ts @@ -68,7 +68,7 @@ export const useResolvedPath = (path: () => string) => { return createMemo(() => route.resolvePath(path())); }; -export const useHref = (to: () => string | undefined) => { +export const useHref = (to: () => T): () => string | T => { const router = useRouter(); return createMemo(() => { const to_ = to(); From f9b6dc6b51387f1ad032b49750706d85bda3910c Mon Sep 17 00:00:00 2001 From: Ryan Carniato Date: Tue, 14 Jan 2025 11:52:44 -0800 Subject: [PATCH 2/2] Create stupid-trainers-shake.md --- .changeset/stupid-trainers-shake.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/stupid-trainers-shake.md diff --git a/.changeset/stupid-trainers-shake.md b/.changeset/stupid-trainers-shake.md new file mode 100644 index 00000000..870e2ea7 --- /dev/null +++ b/.changeset/stupid-trainers-shake.md @@ -0,0 +1,5 @@ +--- +"@solidjs/router": patch +--- + +Make useHref return a string with string param