In this section of the chapter, we will use the knowledge we have gained in writing a service locator, and combine this with TypeScript decorators in order to create a simple DI framework. Before we do, however, let's discuss the problem of interface resolution.
Building a dependency injector
Interface resolution
As we know, the interface keyword is a TypeScript language construct that we use to define the shape of classes or objects. Wherever we need to define a custom type, and need the TypeScript compiler to ensure that properties and functions are available on an object, we use an interface. Interfaces are particularly handy when describing services, where any number of services could provide the same functionality...