In this chapter, we discussed the service locators and DI design patterns. We started by creating a class to send emails, and then created our own simple service locator that could resolve instances of classes given a string name. We then moved to a more resolute Service Location pattern that used class names instead of magic strings as the key to both registering and resolving instances of classes. We then discussed the pitfalls of the Service Location pattern, and implemented a DI framework using decorators.
In our next chapter, we will take a look at what it takes to build applications that combine a web server, such as Node and Express, with a TypeScript-friendly framework, such as Angular.