In this tutorial, you will learn about the TypeScript boolean
data type.
The TypeScript boolean
type allows two values: true
and false
. It’s one of the primitive types in TypeScript. For example:
let present: boolean;
present = true;
// after a while
// ..
present = false;
JavaScript has the Boolean
type that refers to the non-primitive boxed object. The Boolean
type has the letter B
in uppercase, which is different from the boolean
type.
It’s a good practice to avoid using the Boolean
type.