Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: forward parsePath and createPath from history #8278

Merged
merged 8 commits into from Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/react-router-dom/index.tsx
@@ -1,7 +1,8 @@
import * as React from "react";
import type { BrowserHistory, HashHistory, History } from "history";
import { createBrowserHistory, createHashHistory, createPath } from "history";
import { createBrowserHistory, createHashHistory } from "history";
import {
createPath,
MemoryRouter,
Navigate,
Outlet,
Expand All @@ -12,6 +13,7 @@ import {
generatePath,
matchRoutes,
matchPath,
parsePath,
resolvePath,
renderMatches,
useHref,
Expand Down Expand Up @@ -51,6 +53,7 @@ function warning(cond: boolean, message: string): void {

// Note: Keep in sync with react-router exports!
export {
createPath,
MemoryRouter,
Navigate,
Outlet,
Expand All @@ -61,6 +64,7 @@ export {
generatePath,
matchRoutes,
matchPath,
parsePath,
renderMatches,
resolvePath,
useHref,
Expand All @@ -77,6 +81,7 @@ export {
};

export type {
Hash,
Location,
Path,
To,
Expand All @@ -96,6 +101,7 @@ export type {
LayoutRouteProps,
IndexRouteProps,
RouterProps,
Pathname,
KutnerUri marked this conversation as resolved.
Show resolved Hide resolved
RoutesProps
} from "react-router";

Expand Down
9 changes: 7 additions & 2 deletions packages/react-router/index.tsx
@@ -1,19 +1,24 @@
import * as React from "react";
import type {
Hash,
History,
InitialEntry,
Location,
MemoryHistory,
Path,
Pathname,
Search,
To
} from "history";
import {
Action as NavigationType,
createMemoryHistory,
parsePath
parsePath,
createPath
} from "history";

export type { Location, Path, To, NavigationType };
export { parsePath, createPath, NavigationType };
export type { Hash, Location, Path, Pathname, Search, To };

function invariant(cond: any, message: string): asserts cond {
if (!cond) throw new Error(message);
Expand Down