forked from jorgebucaran/hyperapp-router
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
60 lines (51 loc) · 1.14 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { VNode } from "hyperapp";
/** Link */
interface LinkProps {
to: string;
location?: Location;
}
export function Link(props: LinkProps): VNode<LinkProps>;
/** Route */
interface Match<P> {
url: string;
path: string;
isExact: boolean;
params: P;
}
interface RenderProps<P> {
location: Location;
match: Match<P>;
}
interface RouteProps<P> {
parent?: boolean;
path: string;
location?: Location;
render: (props: RenderProps<P>) => VNode<RenderProps<P>>;
}
export function Route<P>(
props: RouteProps<P>
): VNode<RenderProps<P>> | void;
/**Switch */
export function Switch<P>(
props: object,
children: Array<VNode<RouteProps<P>>>
): VNode<object>;
/** Redirect */
interface RedirectProps extends LinkProps {
from?: string
}
export function Redirect(props: RedirectProps): VNode<RedirectProps>;
/** location */
interface LocationState {
pathname: string;
previous: string;
}
interface LocationActions {
go: (pathname: string) => void;
}
interface RouterLocation {
state: LocationState;
actions: LocationActions;
subscribe: (actions: LocationActions) => Function;
}
export declare const location: RouterLocation;