import * as React from "react"; import * as url from "url"; type UrlLike = url.UrlObject | url.Url; export interface EventChangeOptions { shallow?: boolean; [key: string]: any; } export type RouterCallback = () => void; export interface SingletonRouter { readyCallbacks: RouterCallback[]; ready(cb: RouterCallback): void; // router properties readonly components: { [key: string]: { Component: React.ComponentType; err: any }; }; readonly pathname: string; readonly route: string; readonly asPath?: string; readonly query?: { [key: string]: | boolean | boolean[] | number | number[] | string | string[]; }; // router methods reload(route: string): Promise; back(): void; push( url: string | UrlLike, as?: string | UrlLike, options?: EventChangeOptions, ): Promise; replace( url: string | UrlLike, as?: string | UrlLike, options?: EventChangeOptions, ): Promise; prefetch(url: string): Promise>; // router events onAppUpdated?(nextRoute: string): void; onRouteChangeStart?(url: string): void; onBeforeHistoryChange?(as: string): void; onRouteChangeComplete?(url: string): void; onRouteChangeError?(error: any, url: string): void; } export function withRouter( Component: React.ComponentType, ): React.ComponentType; export const Singleton: SingletonRouter; export default Singleton;