mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
Add another signature to match()
This commit is contained in:
Vendored
+11
-3
@@ -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;
|
||||
|
||||
|
||||
@@ -123,7 +123,11 @@ const routes = (
|
||||
</Route>
|
||||
);
|
||||
|
||||
match({history, routes, location: "baseurl"}, (error, redirectLocation, renderProps) => {
|
||||
match({ routes, location: "baseurl" }, (error, redirectLocation, renderProps) => {
|
||||
renderToString(<RouterContext {...renderProps} />);
|
||||
});
|
||||
|
||||
match({ history, routes }, (error, redirectLocation, renderProps) => {
|
||||
renderToString(<RouterContext {...renderProps} />);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user