import * as preact from 'preact'; export function route(url: string, replace?: boolean): boolean; export function route(options: { url: string; replace?: boolean }): boolean; export function exec(url: string, route: string, opts: { default?: boolean }): false | Record; export function getCurrentUrl(): string; export interface Location { pathname: string; search: string; } export interface CustomHistory { listen(callback: (location: Location) => void): () => void; location: Location; push(path: string): void; replace(path: string): void; } export interface RoutableProps { path?: string; default?: boolean | preact.JSX.SignalLike; } export interface RouterOnChangeArgs< RouteParams extends Record | null = Record< string, string | undefined > | null > { router: Router; url: string; previous?: string; active: preact.VNode[]; current: preact.VNode; path: string | null; matches: RouteParams; } export interface RouterProps< RouteParams extends Record | null = Record< string, string | undefined > | null > extends RoutableProps { history?: CustomHistory; static?: boolean; url?: string; onChange?: (args: RouterOnChangeArgs) => void; } export class Router extends preact.Component { canRoute(url: string): boolean; routeTo(url: string): boolean; render(props: RouterProps, {}): preact.VNode; } type AnyComponent = | preact.FunctionalComponent | preact.ComponentConstructor; export interface RouteProps extends RoutableProps { component: AnyComponent; } export function Route( props: RouteProps & Partial ): preact.VNode; export function Link( props: preact.JSX.HTMLAttributes ): preact.VNode; export function useRouter< RouteParams extends Record | null = Record< string, string | undefined > | null >(): [ RouterOnChangeArgs, ( urlOrOptions: string | { url: string; replace?: boolean }, replace?: boolean ) => boolean ]; declare module 'preact' { export interface Attributes extends RoutableProps {} } export default Router;