Skip to content

Commit a48c43c

Browse files
authored
feat: export PathParam type (#10719)
1 parent 3b1a736 commit a48c43c

File tree

7 files changed

+16
-1
lines changed

7 files changed

+16
-1
lines changed

.changeset/cyan-knives-shake.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"react-router-dom-v5-compat": minor
3+
"react-router-native": minor
4+
"react-router-dom": minor
5+
"react-router": minor
6+
"@remix-run/router": minor
7+
---
8+
9+
Export the `PathParam` type from the public API

packages/react-router-dom-v5-compat/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export type {
8585
Params,
8686
Path,
8787
PathMatch,
88+
PathParam,
8889
PathPattern,
8990
PathRouteProps,
9091
Pathname,

packages/react-router-dom/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ export type {
126126
Path,
127127
PathMatch,
128128
Pathname,
129+
PathParam,
129130
PathPattern,
130131
PathRouteProps,
131132
RedirectFunction,

packages/react-router-native/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export type {
5151
Path,
5252
PathMatch,
5353
Pathname,
54+
PathParam,
5455
PathPattern,
5556
PathRouteProps,
5657
RedirectFunction,

packages/react-router/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import type {
1818
Params,
1919
Path,
2020
PathMatch,
21+
PathParam,
2122
PathPattern,
2223
RedirectFunction,
2324
RelativeRoutingType,
@@ -153,6 +154,7 @@ export type {
153154
Params,
154155
Path,
155156
PathMatch,
157+
PathParam,
156158
PathPattern,
157159
PathRouteProps,
158160
Pathname,

packages/router/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export type {
2020
ParamParseKey,
2121
Params,
2222
PathMatch,
23+
PathParam,
2324
PathPattern,
2425
RedirectFunction,
2526
ShouldRevalidateFunction,

packages/router/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ type _PathParam<Path extends string> =
349349
* "/:a/:b" -> "a" | "b"
350350
* "/:a/b/:c/*" -> "a" | "c" | "*"
351351
*/
352-
type PathParam<Path extends string> =
352+
export type PathParam<Path extends string> =
353353
// check if path is just a wildcard
354354
Path extends "*" | "/*"
355355
? "*"

0 commit comments

Comments
 (0)