// Type definitions for React Router 4.0 // Project: https://github.com/ReactTraining/react-router // Definitions by: Sergey Buturlakin // Yuichi Murata // Václav Ostrožlík // Nathan Brown // Alex Wendland // Kostya Esmukov // John Reilly // Karol Janyst // Dovydas Navickas // Tanguy Krotoff // Huy Nguyen // Jérémy Fauvel // Daniel Roth // Egor Shulga // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 import * as React from 'react'; import * as H from 'history'; // This is the type of the context object that will be passed down to all children of // a `Router` component: export interface RouterChildContext

{ router: { history: H.History route: { location: H.Location match: match

} }; } export interface MemoryRouterProps { initialEntries?: H.LocationDescriptor[]; initialIndex?: number; getUserConfirmation?: (() => void); keyLength?: number; } export class MemoryRouter extends React.Component { } export interface PromptProps { message: string | ((location: H.Location) => void); when?: boolean; } export class Prompt extends React.Component { } export interface RedirectProps { to: H.LocationDescriptor; push?: boolean; from?: string; path?: string; exact?: boolean; strict?: boolean; } export class Redirect extends React.Component { } export interface RouteComponentProps

{ match: match

; location: H.Location; history: H.History; staticContext?: any; } export interface RouteProps { location?: H.Location; component?: React.ComponentType> | React.ComponentType; render?: ((props: RouteComponentProps) => React.ReactNode); children?: ((props: RouteComponentProps) => React.ReactNode) | React.ReactNode; path?: string; exact?: boolean; strict?: boolean; } export class Route extends React.Component { } export interface RouterProps { history: any; } export class Router extends React.Component { } export interface StaticRouterProps { basename?: string; location?: string | object; context?: object; } export class StaticRouter extends React.Component { } export interface SwitchProps { children?: React.ReactNode; location?: H.Location; } export class Switch extends React.Component { } export interface match

{ params: P; isExact: boolean; path: string; url: string; } export function matchPath

(pathname: string, props: RouteProps): match

| null; export function withRouter

(component: React.ComponentType & P>): React.ComponentClass

; // decorator signature export function withRouter>(target: TFunction): TFunction;