Skip to content

Commit d712206

Browse files
committed
Changed 33 solution
1 parent 393d7f4 commit d712206

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/06-challenges/33-compose.solution.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
import { expect, it } from "vitest";
22
import { Equal, Expect } from "../helpers/type-utils";
33

4-
export function compose<T1, T2>(a: (t1: T1) => T2): (t1: T1) => T2;
4+
export function compose<T1, T2>(func: (t1: T1) => T2): (t1: T1) => T2;
55
export function compose<T1, T2, T3>(
6-
a: (t1: T1) => T2,
7-
b: (t2: T2) => T3,
6+
func1: (t1: T1) => T2,
7+
func2: (t2: T2) => T3
88
): (t1: T1) => T3;
99
export function compose<T1, T2, T3, T4>(
10-
a: (t1: T1) => T2,
11-
b: (t2: T2) => T3,
12-
c: (t2: T3) => T4,
10+
func1: (t1: T1) => T2,
11+
func2: (t2: T2) => T3,
12+
func3: (t3: T3) => T4
1313
): (t1: T1) => T4;
14+
export function compose<T1, T2, T3, T4, T5>(
15+
func1: (t1: T1) => T2,
16+
func2: (t2: T2) => T3,
17+
func3: (t3: T3) => T4,
18+
func4: (t4: T4) => T5
19+
): (t1: T1) => T5;
1420
export function compose(...funcs: Array<(input: any) => any>) {
1521
return (input: any) => {
1622
return funcs.reduce((acc, fn) => fn(acc), input);
@@ -28,7 +34,7 @@ const stringifyThenAddOne = compose(
2834
String,
2935
// addOne takes in a number - so it shouldn't be allowed after
3036
// a function that returns a string!
31-
addOne,
37+
addOne
3238
);
3339

3440
it("Should compose multiple functions together", () => {

0 commit comments

Comments
 (0)