Type Helpers 9 exercises
Problem

Create a Reusable Type Helper

Consider this CreateDataShape type helper which, as of now, doesn't have any arguments:


type CreateDataShape = {
data: unknown;
error: unknown;
}

From the tests we can see that we should get back an object with data being the first type passed in, and error the second.

For ex

Loading exercise

Transcript

0:00 In this problem, we have a CreateDataShape type helper, which sort of doesn't have any arguments at the moment. We can see that we're calling it down here by passing it a string and a TypeError. It's populating data with string and error with TypeError.

0:13 Same thing here with number and error. Same thing down here with boolean and SyntaxError. Your job is to try and make this work, and try to make a way of specifying multiple type arguments to your type helper.