Can someone please explain the difference between Boolean and boolean in Typescript?
            Asked
            
        
        
            Active
            
        
            Viewed 1.2k times
        
    1 Answers
39
            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 - Everyday Types
 
    
    
        Joel
        
- 5,732
- 4
- 37
- 65
 
    