Why is TypeScript gaining more and more followers?
If a brief description of the main advantages of TypeScript wasn’t enough to convince you to use TypeScript, there is more:
- Errors made during code modification are visible immediately, not at runtime;
- TypeScript helps to write complex solutions that are easier to develop and test;
- The language is easy to learn;
- TypeScript has a high compilation speed and is distributed under the Apache license.
TypeScript adds strict typing to the language. Each variable at creation is assigned a particular type – a standard or created by the developer. You can create a type within the limits of the language. For example, the number from 1 to 31 to record a day in a month, or an array of digits to record coordinates.
The object-oriented approach
The object-oriented approach (OOP) treats the information it deals with as classes and objects. An object is a complex instance of data, and a class is the “blueprint” or “framework” from which objects are created. An object has a class, just as a variable has a type.
TypeScripthas features enable OOP, but only partially. The language supports classes and objects, enough for immediate actions. But, for example, it does not work with access modifiers-so called the ability to make some part of a class “open” or “closed” for outside access.
TypeScript supports three modifiers:
- Public – elements with this modifier are accessible from anywhere without any restrictions. This modifier is set by default.
- Private – elements with this modifier are only available from the class where they are defined.
- Protected – elements with this modifier are available from the class in which they are defined and in subclasses/derived classes.
High Project Speed
How TypeScript works