Add createMemoryHistory to react-router. (#8728)

Since the version 2.0.0, react-router exports createMemoryHistory.
This commit is contained in:
Thomas Hourlier
2016-04-22 23:19:41 -07:00
committed by Masahiro Wakame
parent cc42f09bd1
commit fa4c230580
2 changed files with 10 additions and 2 deletions

View File

@@ -8,7 +8,7 @@
import * as React from "react"
import * as ReactDOM from "react-dom"
import { browserHistory, hashHistory, Router, Route, IndexRoute, Link } from "react-router"
import { browserHistory, hashHistory, createMemoryHistory, Router, Route, IndexRoute, Link } from "react-router"
interface MasterContext {
router: ReactRouter.RouterOnContext;

View File

@@ -86,6 +86,8 @@ declare namespace ReactRouter {
const browserHistory: History;
const hashHistory: History;
function createMemoryHistory(options?: H.HistoryOptions): H.History
/* components */
interface RouterProps extends React.Props<Router> {
@@ -412,6 +414,9 @@ declare module "react-router/lib/useRouterHistory" {
export default function useRouterHistory<T>(createHistory: HistoryModule.CreateHistory<T>): CreateRouterHistory;
}
declare module "react-router/lib/createMemoryHistory" {
export default ReactRouter.createMemoryHistory;
}
declare module "react-router" {
@@ -453,6 +458,8 @@ declare module "react-router" {
import useRouterHistory from "react-router/lib/useRouterHistory";
import createMemoryHistory from "react-router/lib/createMemoryHistory";
// PlainRoute is defined in the API documented at:
// https://github.com/rackt/react-router/blob/master/docs/API.md
// but not included in any of the .../lib modules above.
@@ -492,7 +499,8 @@ declare module "react-router" {
RouterContext,
PropTypes,
match,
useRouterHistory
useRouterHistory,
createMemoryHistory
}
export default Router