We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0b4eee4 commit 7a6ad76Copy full SHA for 7a6ad76
src/08-advanced-patterns/67.5-hoc-for-generic-components.solution.tsx
@@ -1,7 +1,7 @@
1
import { Router, useRouter } from "fake-external-lib";
2
import { Equal, Expect } from "../helpers/type-utils";
3
4
-export const withRouter = <TProps extends { router: Router }>(
+export const withRouter = <TProps,>(
5
Component: (props: TProps) => React.ReactNode,
6
): ((props: Omit<TProps, "router">) => React.ReactNode) => {
7
const NewComponent = (props: Omit<TProps, "router">) => {
@@ -10,7 +10,11 @@ export const withRouter = <TProps extends { router: Router }>(
10
};
11
12
NewComponent.displayName = `withRouter(${
13
- (Component as { displayName?: string }).displayName
+ (
14
+ Component as {
15
+ displayName?: string;
16
+ }
17
+ ).displayName
18
})`;
19
20
return NewComponent;
0 commit comments