Type Transformations Workshop (8 exercises)
Problem

Transform an Object into a Union of Template Literals

In order to really hammer home the technique of working with mapped types and template literals, this exercise will be similar to the last one.

We start with this FruitMap interface and a TransformedFruit type:

Challenge

Your challenge is to map over the object to create a union of strings that are the key and value separated by a colon:

If you get stuck, reference the previous exercise!

Transcript

[0:00] [0: 00] This exercise is pretty similar to the previous exercise, actually. I really want to hammer this home, this technique. You're actually going to be building up from a lower point here.
[0:08] [0: 09] We want to take this FruitMap and turn it into a template literal, which is a union of the keys and the values. Instead of a tuple, it's now going to be a template literal.

[0:18] [0: 19] That's your job, is to find out, with reference to the previous exercise, how to transform this into this union.