Type Transformations Workshop (9 exercises)
Problem

Introducing Type Helpers

Let's look at a new pattern that I'll be calling the Type Helper pattern.

We'll start with a ReturnWhatIPassIn type helper where anything we pass in will be returned.

For example, if we create a type Something and call ReturnWhatIPassIn, we should get back 'Something':

Loading exercise

Transcript

0:00 It's now time to look at a new pattern here, called the type helper pattern. What we're going to do is we want to make this a ReturnWhatIPassIn type helper, where anything that we pass in will be returned.

0:16 What that means is if we have, let's say, type Something = ReturnWhatIPassIn, I should be able to pass Something in there and have Something end up as Something. Currently, it's just any, because this is not particularly valid, because type ReturnWhatIPassIn is not generic. That should give you a clue about what type of syntax we're looking for here. Good luck.