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:
@@ -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
|
||||
|
Reference in New Issue
Block a user