Chapter 5. Decorators and advanced types

 

This chapter covers

  • What the TypeScript decorators are for
  • How to create a new type based on an existing one using mapped types
  • How conditional types work
  • Combining mapped and conditional types

In previous chapters, we covered the main types, which should be sufficient for most of your coding activities. But TypeScript goes further and offers you additional derivative types that can be quite handy in certain scenarios.

We used the word “advanced” in this chapter’s title for a couple of reasons. First, you don’t have to know these types to be a productive member of your team. Second, their syntax may not be immediately obvious to a software developer who’s familiar with other programming languages.

The title of this book is TypeScript Quickly, and the content in the first four chapters deliver on the promise to introduce the main syntax constructs of the language at a fast pace. But you may need to read this chapter more then once.

The good news is that learning the advanced types presented in this chapter is not required to understand the rest of this book. You can skip them if you need to learn the language quickly. You may want to study this chapter if:

5.1. Decorators

5.2. Mapped types

5.3. Conditional types

Summary

sitemap