UNPKG

1.08 kBJavaScriptView Raw
1import React from 'react';
2
3declare module 'react-router' {
4
5 declare type RouterState = {
6 location: ?mixed;
7 routes: ?mixed;
8 params: ?mixed;
9 components: ?mixed;
10 };
11
12 declare type CancelSubscription = () => void;
13
14 declare type TransitionManager = {
15 listen(callback: (error: Error, state: RouterState) => void): CancelSubscription;
16 };
17
18 declare type MatchContext = {
19 history: History;
20 router: mixed;
21 transitionManager: TransitionManager;
22 };
23
24 declare type History = mixed;
25
26 declare type Location = mixed;
27
28 declare var browserHistory: History;
29
30 declare type Route = mixed;
31
32 declare type MatchOptions = {
33 routes: Route;
34 history: History;
35 location?: Location;
36 };
37
38 declare type MatchCallback = (
39 err: ?Error,
40 redirectLocation: ?mixed,
41 props: {
42 history: History;
43 routes: Route;
44 matchContext: MatchContext;
45 }
46 ) => void;
47
48 declare function match(options: MatchOptions, callback: MatchCallback): void;
49
50 declare class RouterContext extends React.Component {
51 props: RouterState;
52 }
53}