@@ -14,7 +14,10 @@ export type Path = string;
14
14
export type PushCallback = ( to : Path , replace ?: boolean ) => void ;
15
15
16
16
export type LocationTuple = [ Path , PushCallback ] ;
17
- export type LocationHook = ( props ?: Pick < RouterProps , 'base' > ) => LocationTuple ;
17
+ export interface LocationHookOptions {
18
+ base ?: Path ;
19
+ }
20
+ export type LocationHook = ( options ?: LocationHookOptions ) => LocationTuple ;
18
21
19
22
export interface DefaultParams {
20
23
[ paramName : string ] : string ;
@@ -25,9 +28,14 @@ export interface RouteComponentProps<T extends DefaultParams = DefaultParams> {
25
28
params : T ;
26
29
}
27
30
28
- export type MatchWithParams < T extends DefaultParams = DefaultParams > = [ true , Params < T > ] ;
31
+ export type MatchWithParams < T extends DefaultParams = DefaultParams > = [
32
+ true ,
33
+ Params < T >
34
+ ] ;
29
35
export type NoMatch = [ false , null ] ;
30
- export type Match < T extends DefaultParams = DefaultParams > = MatchWithParams < T > | NoMatch ;
36
+ export type Match < T extends DefaultParams = DefaultParams > =
37
+ | MatchWithParams < T >
38
+ | NoMatch ;
31
39
32
40
export type MatcherFn = ( pattern : Path , path : Path ) => Match ;
33
41
@@ -36,7 +44,9 @@ export interface RouteProps<T extends DefaultParams = DefaultParams> {
36
44
path : Path ;
37
45
component ?: ComponentType < RouteComponentProps < T > > ;
38
46
}
39
- export function Route < T extends DefaultParams = DefaultParams > ( props : RouteProps < T > ) : VNode < any > | null ; // tslint:disable-line:no-unnecessary-generics
47
+ export function Route < T extends DefaultParams = DefaultParams > (
48
+ props : RouteProps < T > // tslint:disable-line:no-unnecessary-generics
49
+ ) : VNode < any > | null ;
40
50
41
51
export type NavigationalProps =
42
52
| { to : Path ; href ?: never }
@@ -60,14 +70,14 @@ export interface RouterProps {
60
70
base : Path ;
61
71
matcher : MatcherFn ;
62
72
}
63
- export const Router : FunctionComponent <
64
- Partial < RouterProps > & {
65
- children : ComponentChildren ;
66
- }
67
- > ;
73
+ export const Router : FunctionComponent < Partial < RouterProps > & {
74
+ children : ComponentChildren ;
75
+ } > ;
68
76
69
77
export function useRouter ( ) : RouterProps ;
70
78
71
- export function useRoute < T extends DefaultParams = DefaultParams > ( pattern : Path ) : Match < T > ; // tslint:disable-line:no-unnecessary-generics
79
+ export function useRoute < T extends DefaultParams = DefaultParams > (
80
+ pattern : Path
81
+ ) : Match < T > ; // tslint:disable-line:no-unnecessary-generics
72
82
73
- export function useLocation ( props ?: Pick < RouterProps , 'base' > ) : LocationTuple ;
83
+ export function useLocation ( ) : LocationTuple ;
0 commit comments