From a48c43c8118bbf75b23b3ee748648bb3ee4d688e Mon Sep 17 00:00:00 2001 From: Jon Koops Date: Thu, 16 Nov 2023 17:00:00 +0100 Subject: [PATCH] feat: export `PathParam` type (#10719) --- .changeset/cyan-knives-shake.md | 9 +++++++++ packages/react-router-dom-v5-compat/index.ts | 1 + packages/react-router-dom/index.tsx | 1 + packages/react-router-native/index.tsx | 1 + packages/react-router/index.ts | 2 ++ packages/router/index.ts | 1 + packages/router/utils.ts | 2 +- 7 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .changeset/cyan-knives-shake.md diff --git a/.changeset/cyan-knives-shake.md b/.changeset/cyan-knives-shake.md new file mode 100644 index 0000000000..a395f4531b --- /dev/null +++ b/.changeset/cyan-knives-shake.md @@ -0,0 +1,9 @@ +--- +"react-router-dom-v5-compat": minor +"react-router-native": minor +"react-router-dom": minor +"react-router": minor +"@remix-run/router": minor +--- + +Export the `PathParam` type from the public API diff --git a/packages/react-router-dom-v5-compat/index.ts b/packages/react-router-dom-v5-compat/index.ts index adac99a23e..a9e2a15c41 100644 --- a/packages/react-router-dom-v5-compat/index.ts +++ b/packages/react-router-dom-v5-compat/index.ts @@ -85,6 +85,7 @@ export type { Params, Path, PathMatch, + PathParam, PathPattern, PathRouteProps, Pathname, diff --git a/packages/react-router-dom/index.tsx b/packages/react-router-dom/index.tsx index 78b6d8db96..7fbaff3ae6 100644 --- a/packages/react-router-dom/index.tsx +++ b/packages/react-router-dom/index.tsx @@ -126,6 +126,7 @@ export type { Path, PathMatch, Pathname, + PathParam, PathPattern, PathRouteProps, RedirectFunction, diff --git a/packages/react-router-native/index.tsx b/packages/react-router-native/index.tsx index bd4c64ced4..6c52f5efde 100644 --- a/packages/react-router-native/index.tsx +++ b/packages/react-router-native/index.tsx @@ -51,6 +51,7 @@ export type { Path, PathMatch, Pathname, + PathParam, PathPattern, PathRouteProps, RedirectFunction, diff --git a/packages/react-router/index.ts b/packages/react-router/index.ts index 87f0836cdb..d223b0a1a0 100644 --- a/packages/react-router/index.ts +++ b/packages/react-router/index.ts @@ -18,6 +18,7 @@ import type { Params, Path, PathMatch, + PathParam, PathPattern, RedirectFunction, RelativeRoutingType, @@ -153,6 +154,7 @@ export type { Params, Path, PathMatch, + PathParam, PathPattern, PathRouteProps, Pathname, diff --git a/packages/router/index.ts b/packages/router/index.ts index 55bc1646cd..cbacea8bf8 100644 --- a/packages/router/index.ts +++ b/packages/router/index.ts @@ -20,6 +20,7 @@ export type { ParamParseKey, Params, PathMatch, + PathParam, PathPattern, RedirectFunction, ShouldRevalidateFunction, diff --git a/packages/router/utils.ts b/packages/router/utils.ts index f1b879c593..ccbe5537b7 100644 --- a/packages/router/utils.ts +++ b/packages/router/utils.ts @@ -349,7 +349,7 @@ type _PathParam = * "/:a/:b" -> "a" | "b" * "/:a/b/:c/*" -> "a" | "c" | "*" */ -type PathParam = +export type PathParam = // check if path is just a wildcard Path extends "*" | "/*" ? "*"