diff --git a/react-router/react-router-tests.tsx b/react-router/react-router-tests.tsx index 745aff263d..fb3d315e13 100644 --- a/react-router/react-router-tests.tsx +++ b/react-router/react-router-tests.tsx @@ -7,8 +7,9 @@ import * as React from "react" import * as ReactDOM from "react-dom" +import {renderToString} from "react-dom/server"; -import { browserHistory, hashHistory, createMemoryHistory, withRouter, Router, Route, IndexRoute, Link} from "react-router" +import { browserHistory, hashHistory, createMemoryHistory, match, withRouter, Router, RouterContext, Route, IndexRoute, Link} from "react-router" import { routerShape, locationShape } from "react-router/lib/PropTypes" interface MasterContext { @@ -99,3 +100,16 @@ ReactDOM.render(( ), document.body) + + +const history = createMemoryHistory("baseurl"); +const routes = ( + + + + +); + +match({history, routes, location: "baseurl"}, (error, redirectLocation, renderProps) => { + renderToString(); +}); diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index 3fe2538048..fb19dca42d 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -275,6 +275,8 @@ declare namespace ReactRouter { } interface MatchState extends RouterState { history: History + router: Router + createElement: (component: RouteComponent, props: Object) => any } function match(args: MatchArgs, cb: (error: any, nextLocation: H.Location, nextState: MatchState) => void): void