Skip to content

Commit 994b9c0

Browse files
committed
feat: change name
1 parent 9e39f63 commit 994b9c0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

packages/router/utils.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -445,14 +445,14 @@ function matchRouteBranch<
445445
* @private
446446
* Parameters in the path
447447
*/
448-
type PathParams<
448+
type PathParam<
449449
Path extends string
450450
> = Path extends `:${infer Param}/${infer Rest}`
451-
? Param | PathParams<Rest>
451+
? Param | PathParam<Rest>
452452
: Path extends `:${infer Param}`
453453
? Param
454454
: Path extends `${any}:${infer Param}`
455-
? PathParams<`:${Param}`>
455+
? PathParam<`:${Param}`>
456456
: Path extends `${any}/*`
457457
? "*"
458458
: Path extends "*"
@@ -465,16 +465,16 @@ function matchRouteBranch<
465465
* @see https://reactrouter.com/docs/en/v6/utils/generate-path
466466
*/
467467
export function generatePath<Path extends string>(path: Path, params: {
468-
[key in PathParams<Path>]: string
468+
[key in PathParam<Path>]: string
469469
} = {} as any): string {
470470
return path
471-
.replace(/:(\w+)/g, (_, key: PathParams<Path>) => {
471+
.replace(/:(\w+)/g, (_, key: PathParam<Path>) => {
472472
invariant(params[key] != null, `Missing ":${key}" param`);
473473
return params[key]!;
474474
})
475475
.replace(/\/*\*$/, (_) =>
476476
{
477-
const star = "*" as PathParams<Path>
477+
const star = "*" as PathParam<Path>
478478

479479
return params[star] == null ? "" : params[star].replace(/^\/*/, "/")
480480
}

0 commit comments

Comments
 (0)