// tslint:disable:no-unnecessary-generics import { AnchorHTMLAttributes, FunctionComponent, PropsWithChildren, ComponentType, ReactElement, ReactNode, } from "react"; 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) => ReactNode) | ReactNode; path?: Path; component?: ComponentType>; } export function Route( props: RouteProps ): ReactElement | null; /* * Components: & */ export type NavigationalProps = ( | { to: Path; href?: never } | { href: Path; to?: never } ) & HookNavigationOptions; export type LinkProps = Omit< AnchorHTMLAttributes, "href" > & NavigationalProps; export type RedirectProps = NavigationalProps & { children?: never; }; export function Redirect( props: PropsWithChildren>, context?: any ): ReactElement | null; export function Link( props: PropsWithChildren>, context?: any ): ReactElement | 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: ReactNode; } >; /* * Hooks */ export function useRouter(): RouterProps; export function useRoute( pattern: Path ): Match; export function useLocation< H extends BaseLocationHook = LocationHook >(): HookReturnValue; // tslint:enable:no-unnecessary-generics