import type {ComponentClass, ComponentType, FunctionComponent, ReactNode} from 'react'; import type {InjectedRouter, PlainRoute, WithRouterProps} from 'react-router'; import type {Location} from 'history'; declare module 'react-router' { // React 18 removed children from ComponentType, this adds them back interface RouterProps { children?: ReactNode; } // React 18 removed children from ComponentType, this adds them back interface RouteProps { children?: ReactNode; } interface InjectedRouter

, Q = any> { location: Location; params: P; routes: PlainRoute[]; } interface WithRouterProps

, Q = any> { location: Location; params: P; router: InjectedRouter; routes: PlainRoute[]; } interface RouteContextInterface { location: Location; params: P; router: InjectedRouter; routes: PlainRoute[]; } type ComponentConstructor

= | ComponentClass

| FunctionComponent

| ComponentType

; declare function withRouter

( component: ComponentConstructor

, options?: Options ): ComponentClass>; declare function withRouter

( component: ComponentConstructor

& S, options?: Options ): ComponentClass> & S; }