From e6c531d076a4e099bcf858e69ee1947eae28fb5f Mon Sep 17 00:00:00 2001 From: Jake Lane Date: Thu, 31 Dec 2020 11:18:16 +1100 Subject: [PATCH 1/2] Remove deprecated type from withRouter --- src/index.js.flow | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/index.js.flow b/src/index.js.flow index 9641f93c..bc531041 100644 --- a/src/index.js.flow +++ b/src/index.js.flow @@ -99,10 +99,7 @@ declare export function withRouter< Component: ComponentType >( WrappedComponent: Component -): ComponentType< - // $FlowFixMe[deprecated-utility] - $Supertype is deprecated https://github.com/flow-typed/flow-typed/issues/2991 - $Diff>, WithRouterProps> ->; +): ComponentType<$Diff, WithRouterProps>>; declare export function generatePath( pattern: string, From 41b55dd0d194672f5dcc312211a2efd70c5b18b4 Mon Sep 17 00:00:00 2001 From: Jake Lane Date: Thu, 31 Dec 2020 13:09:45 +1100 Subject: [PATCH 2/2] Add missing function props to withRouter --- src/index.js.flow | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/index.js.flow b/src/index.js.flow index bc531041..4645e3c8 100644 --- a/src/index.js.flow +++ b/src/index.js.flow @@ -23,6 +23,8 @@ import type { RouterSubscriberProps, StaticRouterProps, CreateRouterContextOptions, + RouterActionPush, + RouterActionReplace, } from './types.js.flow'; export * from './utils.js.flow'; @@ -90,8 +92,10 @@ declare export function usePathParam( ]; // Utils -type WithRouterProps = RouteContext & {| +export type WithRouterProps = RouteContext & {| history: BrowserHistory, + push: RouterActionPush, + replace: RouterActionReplace, |}; declare export function withRouter<