diff --git a/react-router/lib/match.d.ts b/react-router/lib/match.d.ts index bc5af4fda8..407bcc80c2 100644 --- a/react-router/lib/match.d.ts +++ b/react-router/lib/match.d.ts @@ -3,14 +3,22 @@ import { Basename, LocationDescriptor, ParseQueryString, RouteConfig, StringifyQ interface MatchArgs { routes: RouteConfig; - location: LocationDescriptor; - history?: History; basename?: Basename; parseQueryString?: ParseQueryString; stringifyQuery?: StringifyQuery; } +interface MatchLocationArgs extends MatchArgs { + location: LocationDescriptor; + history?: History; +} + +interface MatchHistoryArgs extends MatchArgs { + location?: LocationDescriptor; + history: History; +} + export type MatchCallback = (error: any, redirectLocation: Location, renderProps: any) => void; -export default function match(args: MatchArgs, cb: MatchCallback): void; +export default function match(args: MatchLocationArgs | MatchHistoryArgs, cb: MatchCallback): void; diff --git a/react-router/react-router-tests.tsx b/react-router/react-router-tests.tsx index dda05ef9d8..894dfec8c7 100644 --- a/react-router/react-router-tests.tsx +++ b/react-router/react-router-tests.tsx @@ -123,7 +123,11 @@ const routes = ( ); -match({history, routes, location: "baseurl"}, (error, redirectLocation, renderProps) => { +match({ routes, location: "baseurl" }, (error, redirectLocation, renderProps) => { + renderToString(); +}); + +match({ history, routes }, (error, redirectLocation, renderProps) => { renderToString(); });