In versions of JavaScript prior to and including the fifth version, objects have no specific types attached to them. We can use prototypes and constructor functions to create objects with predefined shapes (that is, with properties and functions attached to them), but further properties and functions may be attached to them at any point. ECMAScript 6 introduces classes that will be described later in this book, but their usage is not obligatory, and the developer may continue using also untyped objects.
TypeScript introduces interfaces to describe the shape of both untyped and typed objects. Thus, TypeScript interfaces can be used as in C# to define the functionality to be implemented by classes, as well as to assign types to untyped objects based on their structure. In short, TypeScript interfaces assign names to structural features of usual JavaScript...