- and many more...
This is the most basic type which is onlt two values possible:
false. How to declare a boolean type? Pretty ease actually:
let myFlag: boolean = true // After doing this you can make all the usual uses for a boolean variable, with the only difference that you can't redeclare the type value as we saw before. myFlag = 'true' // TypeSciprt will alert that this is impossible because myFlag is a boolean type and not an string type
As the name says, this is a number type that can assign: integers, floating point, hexadecimal, decimal, octal and binaries values. By assigning the number type, if you are using VS Code you can access into all the functions and methods available to the number type thanks to the Intellisense feature.
String types are the usual variables to use a paragraph, URL, etc, values given into our variable. We can set an string type by using
Arrays are a particular case in TypeScript because there two ways to declare an array variable. To set this type we need have to
// We can set this variable like this: const myArray: number =  or const myArray: Array<number> = 
And we can access all the functions available for the array type:
This particular type is special because if we declare an array of type as we can see at the previous example, we can't add another value type into the array, and if you try, Intellisense will alert you that is forbidden:
As we can see, the Intellisense from VSCode didn't alert me by changing the value of an any var, of by adding any var type into the array.