Advanced Generics 9 exercises

Generic Function Currying

This curryFunction function takes a value and returns a function that returns another function, eventually resulting in an object:

export const curryFunction =
<T, U, V>(t: T) =>
(u: U) =>
(v: V) => {
return {

The function curren

Loading exercise


0:00 In this problem, we have a function called curryFunction. What this does is it basically takes...You pass in the first value, which returns a function, which returns another function, which returns another function, and you eventually end up with a result that looks like this object.

0:19 You basically call this first function, which returns another function which you call, which then returns another function which you call. This is classic function currying.

0:28 What we've got here is we have a result where it looks like only the first one of this is being inferred. If I change this to a string, for instance, then here, yeah, it's only inferring string but it's not inferring number for any of the others there.

0:46 If we look at this structure here, we can see that we have this T, U, V, and all of these type arguments are on the first function here. Your job is to try to get the inference working so that we have this number being inferred here, number being inferred there, and number being inferred there.

1:05 Good luck.