If there is one feature in TypeScript that stands out from its competitor, it is Type System, and how TypeScript uses types to help write better code. Types in TypeScript are one of the easiest features to understand and use, thus providing the maximum productivity boost for a new developer to TypeScript.
To develop any application with TypeScript, understanding types and their features is very important. Hence, we will look at the following topics in this section, which will then help us when we start working on our application:
- Variables: We will start by looking at how to declare variables and constants in TypeScript. We will also look at the let and const keywords, which were introduced in ES 2015 to provide better scoping.
- Types: We will then shift our focus to looking at types provided by TypeScript, which include both primitive and custom types.
- Type inference: Then we will look at how TypeScript uses type inference to help identify the types.
- Type compatibility: TypeScript has a feature wherein we can relate types based on members only; we will take a look at this with an example.