Summary

In this chapter, we visited many object-oriented features. TypeScript is closing the gap with well-known programming languages that are object-oriented such as C# or Java. TypeScript, being a superset of JavaScript, must palliate some weakness of JavaScript in this regard but finish with its head-up with many features that are acceptable to write a professional application in an object-oriented fashion.

We saw how to work with encapsulation, which allows us to control the visibility of fields and functions. We discussed ways to strongly type a constructor, as well as how to use an interface to be implemented by a class. Within a class, we saw how to have static functions and abstraction functions. The next chapter will cover how we can identify precisely which type, object, or variable we are manipulating, allowing us to leverage specific members that are unique to each of them. We will see how to use JavaScript typecheckers, such as typeof and instanceof, and how to pattern with discriminator and defined guard for a structured type.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.131.38.210