From 2e6ef3f6a4bb7523834a7b49bfb3e72097920a00 Mon Sep 17 00:00:00 2001 From: Kepler Sticka-Jones Date: Sun, 12 Nov 2017 12:15:37 -0700 Subject: [PATCH] Add withRouter HOC to next.js typedef --- types/next/router.d.ts | 2 ++ types/next/test/next-router-tests.tsx | 2 ++ 2 files changed, 4 insertions(+) diff --git a/types/next/router.d.ts b/types/next/router.d.ts index 021b0dd3dc..0c831d8600 100644 --- a/types/next/router.d.ts +++ b/types/next/router.d.ts @@ -32,5 +32,7 @@ export interface SingletonRouter { onRouteChangeError?(error: any, url: string): void; } +export function withRouter(Component: React.ComponentType): React.ComponentType; + export const Singleton: SingletonRouter; export default Singleton; diff --git a/types/next/test/next-router-tests.tsx b/types/next/test/next-router-tests.tsx index 37e739d98a..e713f127b7 100644 --- a/types/next/test/next-router-tests.tsx +++ b/types/next/test/next-router-tests.tsx @@ -51,3 +51,5 @@ Router.replace('/route', '/asRoute', {shallow: false}).then((success: boolean) = Router.prefetch('/route').then(Component => { const element = (); }); + +r.withRouter(props =>
);