Type Transformations Workshop (9 exercises)

Extract Parts of a Discriminated Union

In this exercise, we have the same Event discriminated union that we’ve used before:

Your job is to grab the type of click or focus or keyDown from the discriminated union so that the following test passes:

Don’t overthink it!

This exercise is easier than it seems, and we've already covered all of the pieces you'll need to solve it!


[0:00] In this exercise, we have a discriminated union, the same one that you've seen before. What I'd like you to do is grab out the type here of click or focus or keydown from the discriminated union.
[0:13] This exercise is actually easier than it seems, so don't go too deep into anything too crazy. All of the pieces that you need for this have been covered before. Good luck.