Skip to content

Commit 6d591dd

Browse files
committed
Made 09 easier
1 parent 8114de4 commit 6d591dd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/02-passing-type-arguments/09-generics-in-type-arguments-in-arguments.problem.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ export class Component<TProps> {
1111
getProps = () => this.props;
1212
}
1313

14-
const cloneComponent = (component: unknown) => {};
14+
const cloneComponent = (component: unknown) => {
15+
return new Component(component.getProps());
16+
};
1517

1618
it("Should clone the props from a passed-in Component", () => {
1719
const component = new Component({ a: 1, b: 2, c: 3 });
@@ -23,6 +25,6 @@ it("Should clone the props from a passed-in Component", () => {
2325
expect(result).toEqual({ a: 1, b: 2, c: 3 });
2426

2527
type tests = [
26-
Expect<Equal<typeof result, { a: number; b: number; c: number }>>,
28+
Expect<Equal<typeof result, { a: number; b: number; c: number }>>
2729
];
2830
});

0 commit comments

Comments
 (0)