The basic types are boolean, number, string, array, tuple, Object, object, null, undefined, {}, void, and enumerations. Let's learn about each of these basic types:
Data type |
Description |
Boolean |
Whereas the string and number data types can have a virtually unlimited number of different values, the boolean data type can only have two. They are the literals: true and false. A boolean value is a truth value; it specifies whether the condition is true or not: let isDone: boolean = false; |
Number |
As in JavaScript, all numbers in TypeScript are floating-point values. These floating-point numbers get the type number: let height: number = 6; |
String |
We use the string data type to represent ... |