fix(params): enforce non-undefined route parameter values

- Update `Params` type to disallow `undefined` values for clarity.
- Default route parameter values to empty strings if `null` or `undefined`.

Signed-off-by: Max P. <Mail@MPassarello.de>
This commit is contained in:
2025-05-07 19:40:08 +02:00
parent 6c4420d32f
commit b0c6901d7d
2 changed files with 2 additions and 2 deletions

View File

@@ -35,7 +35,7 @@ export function createRouteMatcher(
// 3b. Extract route params
const params: Params = {};
for (const [key, value] of Object.entries(result.pathname.groups)) {
params[key] = value;
params[key] = value ?? ''; // null → empty string
}
// 3c. Extract query parameters – keep duplicates as arrays