Add Conditional Logic to a Type Helper
In this exercise we're going to add something on to the type helper pattern.
Since we know that we can return things from a function, it makes sense that we could include conditional logic that will return something different based on what gets passed in.
Your challenge is to add conditional logic to the
YouSayGoodbyeAndISayHello type so that passing in "hello" returns "goodbye" and vice versa:
[0:00] [0: 00] We're now going to take that type helper pattern that we had before and add something else to it. Now that we know that we can return things from a function, it makes sense that we could do if else logic within that function and return something different based on what gets passed in.
[0:15] [0: 16] This type function that we're going to create, it's going to say YouSayGoodbyeAndISayHello. When we pass in hello, we should expect goodbye. When we pass in goodbye, we should expect hello to come back.
[0:28] [0: 30] That's your goal, is to try and find some sort of tool within TypeScript to let you do that. I'll give you a clue. It's called conditional types. Good luck.