// Type definitions for React Router 5.1 // Project: https://github.com/ReactTraining/react-router // Definitions by: Huy Nguyen // Philip Jackson // John Reilly // Sebastian Silbermann // Daniel Nixon // Tony Ward // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import { match } from 'react-router'; import * as React from 'react'; import * as H from 'history'; export { generatePath, Prompt, MemoryRouter, RedirectProps, Redirect, RouteChildrenProps, RouteComponentProps, RouteProps, Route, Router, StaticRouter, SwitchProps, Switch, match, matchPath, withRouter, RouterChildContext, useHistory, useLocation, useParams, useRouteMatch, } from 'react-router'; export interface BrowserRouterProps { basename?: string; getUserConfirmation?: (message: string, callback: (ok: boolean) => void) => void; forceRefresh?: boolean; keyLength?: number; } export class BrowserRouter extends React.Component {} export interface HashRouterProps { basename?: string; getUserConfirmation?: (message: string, callback: (ok: boolean) => void) => void; hashType?: 'slash' | 'noslash' | 'hashbang'; } export class HashRouter extends React.Component {} export interface LinkProps extends React.AnchorHTMLAttributes { component?: React.ComponentType; to: H.LocationDescriptor | ((location: H.Location) => H.LocationDescriptor); replace?: boolean; innerRef?: React.Ref; } export function Link( // TODO: Define this as ...params: Parameters> when only TypeScript >= 3.1 support is needed. props: React.PropsWithoutRef> & React.RefAttributes, ): ReturnType>; export interface Link extends React.ForwardRefExoticComponent< React.PropsWithoutRef> & React.RefAttributes > {} export interface NavLinkProps extends LinkProps { activeClassName?: string; activeStyle?: React.CSSProperties; exact?: boolean; strict?: boolean; isActive?(match: match, location: H.Location): boolean; location?: H.Location; } export function NavLink( // TODO: Define this as ...params: Parameters> when only TypeScript >= 3.1 support is needed. props: React.PropsWithoutRef> & React.RefAttributes, ): ReturnType>; export interface NavLink extends React.ForwardRefExoticComponent< React.PropsWithoutRef> & React.RefAttributes > {}