Type Transformations Workshop (8 exercises)
Problem

Create a New Object based on Another

Let’s continue with the Attributes interface and the AttributeGetters helper from the previous exercise:

Challenge

We’ve created the getter functions, but they could be named better.

Your challenge is to figure out how to keep the structure of the current solution, but remap the key to a new one that it is prefixed with get as seen in the test:

Reference the Mapped Type docs if you get stuck.

Transcript

[0:00] [0: 00] This exercise starts as the previous exercise ended, where we have a set of Attributes and a set of AttributeGetters. We're started from the exact same solution except now that the game has changed a little bit.
[0:13] [0: 16] We now want to create a getFirstName() function, getLastName() function, and getAge() function, whereas, in the previous exercise, what we had was just firstName, lastName, and age. We're wanting to remap the key a little bit.

[0:30] [0: 30] We need to find a way within this structure here to take this key and remap it to something else, to a different key, because what we're needing to do is create getFirstName() out of firstName. Again, make sure you don't change this. The only thing you'll need to change is something on this line. Good luck.