File tree Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' sv-router ' : patch
3
+ ---
4
+
5
+ Add typesafe pathname
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ export function createRouter(r) {
46
46
return params . value ;
47
47
} ,
48
48
get pathname ( ) {
49
- return location . pathname ;
49
+ return /** @type { import('./index.d.ts').Path<T> } */ ( location . pathname ) ;
50
50
} ,
51
51
get search ( ) {
52
52
return location . search ;
Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ export type RouterApi<T extends Routes> = {
134
134
*/
135
135
params : AllParams < T > ;
136
136
/** The reactive pathname of the URL. */
137
- pathname : string ;
137
+ pathname : Path < T > ;
138
138
/** The reactive query string part of the URL. */
139
139
search : string ;
140
140
/** The reactive history state that can be passed to the `navigate` function. */
You can’t perform that action at this time.
0 commit comments