Skip to content

Commit 6e4f3b9

Browse files
docs: explain why route id can be null (#13581)
* . * Revert "." This reverts commit be452ea. * update public.d.ts --------- Co-authored-by: Rich Harris <[email protected]>
1 parent 34fb711 commit 6e4f3b9

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

packages/kit/src/exports/public.d.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ export interface NavigationEvent<
990990
*/
991991
route: {
992992
/**
993-
* The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`
993+
* The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`. It is `null` when no route is matched.
994994
*/
995995
id: RouteId;
996996
};
@@ -1012,7 +1012,12 @@ export interface NavigationTarget {
10121012
/**
10131013
* Info about the target route
10141014
*/
1015-
route: { id: string | null };
1015+
route: {
1016+
/**
1017+
* The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`. It is `null` when no route is matched.
1018+
*/
1019+
id: string | null;
1020+
};
10161021
/**
10171022
* The URL that is navigated to
10181023
*/
@@ -1129,7 +1134,7 @@ export interface Page<
11291134
*/
11301135
route: {
11311136
/**
1132-
* The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`.
1137+
* The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`. It is `null` when no route is matched.
11331138
*/
11341139
id: RouteId;
11351140
};
@@ -1205,7 +1210,7 @@ export interface RequestEvent<
12051210
*/
12061211
route: {
12071212
/**
1208-
* The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`.
1213+
* The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`. It is `null` when no route is matched.
12091214
*/
12101215
id: RouteId;
12111216
};

packages/kit/types/index.d.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ declare module '@sveltejs/kit' {
972972
*/
973973
route: {
974974
/**
975-
* The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`
975+
* The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`. It is `null` when no route is matched.
976976
*/
977977
id: RouteId;
978978
};
@@ -994,7 +994,12 @@ declare module '@sveltejs/kit' {
994994
/**
995995
* Info about the target route
996996
*/
997-
route: { id: string | null };
997+
route: {
998+
/**
999+
* The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`. It is `null` when no route is matched.
1000+
*/
1001+
id: string | null;
1002+
};
9981003
/**
9991004
* The URL that is navigated to
10001005
*/
@@ -1111,7 +1116,7 @@ declare module '@sveltejs/kit' {
11111116
*/
11121117
route: {
11131118
/**
1114-
* The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`.
1119+
* The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`. It is `null` when no route is matched.
11151120
*/
11161121
id: RouteId;
11171122
};
@@ -1187,7 +1192,7 @@ declare module '@sveltejs/kit' {
11871192
*/
11881193
route: {
11891194
/**
1190-
* The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`.
1195+
* The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`. It is `null` when no route is matched.
11911196
*/
11921197
id: RouteId;
11931198
};

0 commit comments

Comments
 (0)