Transcript from the "Function Overloads Exercise" Lesson
[00:00:30] If I say, add(2), it should return a function that waits for the second argument. So I could say const addTwo, And then if I said, addTwo, let's say to (5), that should give me 7. So effectively, there's two different interfaces, you give it two numbers, it gives you back a value, you give it one number, it gives you back a function that takes a second number, sevent.
[00:01:07] Right, or we can also just say like ten is, My math is doing great right now, right? Live coding fine live math is apparently a lot harder. Now you can see TypeScript a little angrier about this cuz it doesn't really understand what's happening. But, we wanna basically support both giving it two arguments or giving it one argument, and then the second one later, right?
[00:01:36] And so kinda looking at the async ad, you can see that we're definitely gonna have two lines, which effectively define both of the different interfaces that we want to support for it, right? And you can make helper types like this is for the asynchronous one where it's a callback where it's gonna say it takes a number and returns nothing, that we're using here.
[00:01:55] You can use helper types, you can do it online but, your mission for the next five minutes, is to take a stab at trying to add function overloads, for this add function right here.