From the course: TypeScript Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Challenge: Types

Challenge: Types

(upbeat electronic music) - [Instructor] In this chapter, I introduced you to a number of ways to apply types to your JavaScript code. For this challenge, I've given you a JavaScript application in your exercise files. I've already created the tsconfig.json file, but your challenge is to find a place to apply each of the techniques that I've shown you in this chapter. First, create an interface to describe the structure of this variable. Hint: It's an array. So you want to define the interface for the type of items that are in the array, not the whole array. Next, I want you to strongly type some hard-coded values with an enum. Then, apply types to the parameters and return values of these functions. And also, use a generic parameter to define the parameter type of this function. This one will probably take you a little bit longer to finish. You might be able to finish it in under 15 minutes, but don't be…

Contents