In TypeScript, there are two distinct "number" types. The first one is called lowercase number, and the second is uppercase Number. If you try printing number, there is compiler error:
console.log(number); //-> error TS2693: 'number' only refers to a type
On the other hand, printing Number will give the standard function description:
console.log(Number); //-> [Function: Number]
This is unsurprising as Number is just a built-in JS constructor documented here. However, it is unclear, what number is supposed to be.
Judging by the error message, it seems that number isn't actually a discrete value(?!) like Number. But despite this, it is used in variable and function declarations as if it is a value, like:
var two: number = 2;
function sqr(x: number) { return x; }
On the other hand, user-defined types like classes appear to be discrete values (as they also print the standard function description). And, to further complicate matters, Number can be used in annotations similar to number:
var two: Number = 2;
There is similar cases with string and String, any and Object, etc.
So, my question is: What are number, string, etc in TypeScript, and how are they different then built-in constructors?