In this chapter, we learned about important features in TypeScript. Now that you know about generics and enums, you can write better code and eliminate a lot of duplication in your applications. While building MediaMan, we also had occasion to put those concepts to good use.
Building MediaMan has also allowed us to introduce many other TypeScript features, such as the following:
- Type definitions (typings)
- String literal types
- Union and intersection types
- Decorators
- The any special type
- The keyof index type query operator
- Mapped types
Since we wanted to build an offline web application, we also learned about standard web APIs such as LocalStorage, SessionStorage, and IndexedDB.
We then explored, in practice, how to leverage these using the open source localForage library. While doing so, we also introduced the Promise API, which helped us to easily deal with asynchronous operations in a clean manner. We also learned how to serialize and deserialize data using the class-transformer library and TypeScript decorators.
Finally, we presented the service layer design pattern and leveraged it to better separate concerns in our application.
At this point in our journey, you may feel that we still lack some important knowledge that is necessary for building larger applications. One big concern with the code of MediaMan is that it is all stored in a single file. This is, of course, far from ideal as it impacts readability and testability. In the next chapter, we will learn about modules, which will help us to modularize our code and make it easier to read, understand, navigate, and maintain.
Additionally, we haven't tested any of our code so far and it's normal to feel really bad about that! This means that there are probably bugs in our code that we could've detected and fixed. In the next chapter, we will also introduce you to libraries and tools that you can use to test your applications.