Skip to content

Commit 7a6ad76

Browse files
committed
Completed 67.5
1 parent 0b4eee4 commit 7a6ad76

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/08-advanced-patterns/67.5-hoc-for-generic-components.solution.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Router, useRouter } from "fake-external-lib";
22
import { Equal, Expect } from "../helpers/type-utils";
33

4-
export const withRouter = <TProps extends { router: Router }>(
4+
export const withRouter = <TProps,>(
55
Component: (props: TProps) => React.ReactNode,
66
): ((props: Omit<TProps, "router">) => React.ReactNode) => {
77
const NewComponent = (props: Omit<TProps, "router">) => {
@@ -10,7 +10,11 @@ export const withRouter = <TProps extends { router: Router }>(
1010
};
1111

1212
NewComponent.displayName = `withRouter(${
13-
(Component as { displayName?: string }).displayName
13+
(
14+
Component as {
15+
displayName?: string;
16+
}
17+
).displayName
1418
})`;
1519

1620
return NewComponent;

0 commit comments

Comments
 (0)