Skip to content

Commit e30f46f

Browse files
authored
Merge pull request #505 from sugar700-old/make-use-href-not-return-null-with-string-parameter
Make useHref return a string with string param
2 parents 890c520 + f9b6dc6 commit e30f46f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solidjs/router": patch
3+
---
4+
5+
Make useHref return a string with string param

src/routing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const useResolvedPath = (path: () => string) => {
6868
return createMemo(() => route.resolvePath(path()));
6969
};
7070

71-
export const useHref = (to: () => string | undefined) => {
71+
export const useHref = <T extends string | undefined>(to: () => T): () => string | T => {
7272
const router = useRouter();
7373
return createMemo(() => {
7474
const to_ = to();

0 commit comments

Comments
 (0)