import { History, Path, State, Listener, RemoveListenerCallback, PathRecord } from './history'; export type IParams = Record; export type IRouteComponentProps = Record; export type IRouteRecord = { path: string; component?: Element; children?: IRouteRecord[]; props?: IRouteComponentProps; redirect?: string; caseSensitive?: boolean; } & ExtendedTypes; export type NavigationGuardNextCallback = () => any; export interface NavigationGuardNext { (): void; (error: Error): void; (location: string | { path?: string; replace?: boolean; skipGuards?: boolean; state?: any; }): void; (valid: boolean | undefined): void; (cb: NavigationGuardNextCallback): void; } export interface NavigationGuardHook { (to: IRoute, from: IRoute, next: NavigationGuardNext): void; } export interface NavigationGuardHookWithContext { (to: IRoute, from: IRoute, next: NavigationGuardNext, context: NavigationHookContext): void; } export interface NavigationResolvedHook { (to: IRoute, from: IRoute): void; } export interface NavigationHookContext { props?: Record; } export interface IRouteMatch { route: T; pathname: string; params: IParams; } export type IRouteBranch = [string, T[], number[]]; export type IPathPattern = string | { path: string; caseSensitive?: boolean; end?: boolean; }; export interface IPathMatch { path: string; pathname: string; params: IParams; } export type IPartialRouteRecord = Partial>; export interface IRoute extends Path { params: IParams; state: State; matches: IRouteMatch[]; redirected?: boolean; key: string; } export interface IRouter { current: IRoute; action: History['action']; basename: string; push(to: PathRecord, state?: any): void; replace(to: PathRecord, state?: any): void; go: History['go']; back: History['back']; block: History['block']; resolve: History['resolve']; forward(): void; ready: Promise; routes: RouteRecord[]; match(to: PathRecord): Array>; init: () => IRouter; listen: (listener: Listener) => RemoveListenerCallback; beforeEach: (listener: NavigationGuardHook) => RemoveListenerCallback; beforeResolve: (listener: NavigationGuardHook) => RemoveListenerCallback; afterEach: (listener: NavigationResolvedHook) => RemoveListenerCallback; replaceRoutes: (routes: RouteRecord[]) => void; }