TypeScript has great support for OOP. With TypeScript, you can define the following:
- Classes
- Interfaces
- Mixins
Specifically for classes, you can define the following:
- Fields and methods
- Constructors and parameter properties
- Field/method visibility using the public (default), protected, and private keywords
- Static fields and methods
- Read-only properties
- Accessors using the get and set keywords
In addition, TypeScript supports inheritance through the extends keyword, and you can override methods in descendants.
Mixins are supported in TypeScript and provide an alternative way to build classes by combining other ones. You can learn more about mixins here: https://www.typescriptlang.org/docs/handbook/mixins.html.
Classes and interfaces are not only great OO concepts, but they're also very useful for type checking in TypeScript,...