Type Transformations Workshop (4 exercises)
Problem

Transform an Object into a Discriminated Union

This exercise begins with this Attributes interface and an empty MutuallyExclusive<T>:

Challenge

Your challenge is to update MutuallyExclusive to be a type helper that will turn the Attributes object into a discriminated union.

Check your work by hovering over ExclusiveAttributes as you go.

Transcript

[0:00] [0: 00] This next challenge takes an object, takes in any old object you can pass in, and turns it into a discriminated union of all of the individual properties of that object. Attributes here, what we should end up with is id or email or username.
[0:19] [0: 20] This is a cool challenge. It tests your brain a little bit, but there's nothing new in here. Nothing you haven't seen before. All we want to do is turn MutuallyExclusive into this type helper, which can transform this.

[0:32] [0: 32] You can use ExclusiveAttributes here to check how you're doing. Good luck.