Skip to content

Commit b93c0f9

Browse files
committed
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.
1 parent 1c9eb8e commit b93c0f9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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)