TypeScript Boolean Type

Type Script History

Boolean  data type can only hold two valid values(true or false). You can only set the  true or false values.  These values are used a lot in control structures where one piece of code is executed if a condition is true and another piece of code is executed if a condition is false. 

Here is a very basic example of declaring Boolean variables:

  

        let booVal1: boolean = true;
        let booVal2: boolean = false;
        let booVal3: boolean = 103;     // Type '103' is not assignable to type 'boolean'.
        let booVal4: boolean = "blue"; //  Type '"blue"' is not assignable to type 'boolean'.