Skip to content

Commit

Permalink
Fix ts definitions for reading route params
Browse files Browse the repository at this point in the history
  • Loading branch information
egorshulga committed Feb 15, 2021
1 parent 1f494e6 commit f798aab
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
export type Route = {
name: string;
path: string | RegExp;
handler: Function;
handler: Handler;
hooks: RouteHooksStorage;
};
export type Handler = (match: Match) => void
export type Match = {
url: string;
queryString: string;
hashString: string;
route: Route;
data: Object | null;
params: Object | null;
data: { [key: string]: string } | null;
params: { [key: string]: string } | null;
};
export type BeforeHook = (done: Function, match: Match) => void;
export type AfterHook = (match: Match) => void;
Expand Down Expand Up @@ -62,9 +63,9 @@ declare class Navigo {
destroyed: boolean;
current: null | Match[];
lastResolved(): null | Match[];
on(f: Function, hooks?: RouteHooks): Navigo;
on(f: Handler, hooks?: RouteHooks): Navigo;
on(map: Object, hooks?: RouteHooks): Navigo;
on(path: string | RegExp, f: Function, hooks?: RouteHooks): Navigo;
on(path: string | RegExp, f: Handler, hooks?: RouteHooks): Navigo;
off(path: string | RegExp): Navigo;
off(handler: Function): Navigo;
navigate(to: string, options?: NavigateOptions): void;
Expand Down

0 comments on commit f798aab

Please sign in to comment.