Previous sections listed some techniques to manipulate generic type instances notwithstanding the complete lack of knowledge of the operations and properties supported by the type that later on will replace the generic. Sometimes, the techniques exposed so far are not sufficient to encode an abstract behavior, and sometimes one may need more than one technique, namely:
- Invoking specific members that must be contained in the type that will bind the generic type
- Creating an instance of the type that will bind the generic type
The first need can be satisfied by declaring that the generic type can be bound only by types that have the required members. Since interfaces are TypeScript's way of expressing constraints on the members contained in objects, constraints on members translate into requiring interface implementations.