mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
Add createMemoryHistory to react-router. (#8728)
Since the version 2.0.0, react-router exports createMemoryHistory.
This commit is contained in:
committed by
Masahiro Wakame
parent
cc42f09bd1
commit
fa4c230580
@@ -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;
|
||||
|
||||
10
react-router/react-router.d.ts
vendored
10
react-router/react-router.d.ts
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user