// tslint:disable:no-unnecessary-generics import { JSX, FunctionComponent, ComponentType, ComponentChildren, VNode, } from "preact"; import { Path, BaseLocationHook, HookReturnValue, HookNavigationOptions, LocationHook, } from "./use-location"; import { DefaultParams, Params, Match, MatcherFn } from "./matcher"; // re-export types from these modules export * from "./matcher"; export * from "./use-location"; /* * Components: */ export interface RouteComponentProps { params: T; } export interface RouteProps { children?: ((params: Params) => ComponentChildren) | ComponentChildren; path?: Path; component?: ComponentType>; } export function Route( props: RouteProps ): VNode | null; /* * Components: & */ export type NavigationalProps = ( | { to: Path; href?: never } | { href: Path; to?: never } ) & HookNavigationOptions; export type LinkProps = Omit< JSX.HTMLAttributes, "href" > & NavigationalProps; export type RedirectProps< H extends BaseLocationHook = LocationHook > = NavigationalProps & { children?: never; }; export function Link( props: LinkProps ): VNode | null; export function Redirect( props: RedirectProps ): VNode | null; /* * Components: */ export interface SwitchProps { location?: string; children: Array>; } export const Switch: FunctionComponent; /* * Components: */ export interface RouterProps { hook: BaseLocationHook; base: Path; matcher: MatcherFn; } export const Router: FunctionComponent< Partial & { children: ComponentChildren; } >; /* * Hooks */ export function useRouter(): RouterProps; export function useRoute( pattern: Path ): Match; export function useLocation< H extends BaseLocationHook = LocationHook >(): HookReturnValue; // tslint:enable:no-unnecessary-generics