Creating classes and types
The basis of application development using Angular is object-oriented programming, so it is important for us to delve into how to create classes and instantiate objects. Using TypeScript instead of pure JavaScript, we have another powerful element in our toolbox of types.
By typifying variables and objects, the TypeScript transpiler is able to carry out checks and alerts, preventing errors that could occur at runtime during development if this process did not exist.
Bear in mind that after transpiling (a process that transforms TypeScript code into JavaScript), the code delivered to the client’s browser is pure JavaScript, including some optimizations; that is, code written in TypeScript is no less performant than code written directly in JavaScript.
To start with the fundamentals, let’s explore primitive and basic types.
Primitive and basic types
JavaScript, despite not being a strongly typed language, has three types called...