What is the difference between Boolean and boolean in Typescript? [duplicate] What is the difference between Boolean and boolean in Typescript? [duplicate] angular angular

What is the difference between Boolean and boolean in Typescript? [duplicate]


Uppercase Boolean is an object type.

Lowercase boolean is a primitive type.

You should always use boolean (the primitive type in your programs).This is because, the Typescript type system does not force an object to its primitive type, while JavaScript does.

You shouldn't write:

function yourFunction(foo: Boolean)

But instead always write:

function yourFunction(foo: boolean)

For more info, see TypeScript Lang - Basic Types