Skip to content

Commit 1d447ad

Browse files
committed
add typing for withRouter function
1 parent a0a0545 commit 1d447ad

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

react-router.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,16 @@ declare module ReactRouter {
757757
* @param {((Route | PlainRoute)[])} routes
758758
*/
759759
export function createRoutes(routes: (Route | PlainRoute)[]): Route[];
760+
761+
/**
762+
* Add router object to props of pure component
763+
*/
764+
export function withRouter<T>(fun: (props: T & { router: IRouter }) => JSX.Element): (props: T) => JSX.Element;
765+
766+
/**
767+
* Add router object to props of component
768+
*/
769+
export function withRouter<T extends Function>(el: T): T;
760770
}
761771

762772
export = ReactRouter;

0 commit comments

Comments
 (0)