title: What is the difference between "number" and "Number" in TypeScript?
body: <p>In TypeScript, there are two distinct &quot;number&quot; types. The first one is called lowercase <code>number</code>, and the second is uppercase <code>Number</code>. If you try printing <code>number</code>, there is compiler error:</p>
  <pre class="lang-js prettyprint-override"><code>console.log(number); //-&gt; error TS2693: 'number' only refers to a type
  </code></pre>
  <p>On the other hand, printing <code>Number</code> will give the standard function description:</p>
  <pre class="lang-js prettyprint-override"><code>console.log(Number); //-&gt; [Function: Number]
  </code></pre>
  <p>This is unsurprising as <code>Number</code> is just a built-in JS constructor documented <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number" rel="noreferrer">here</a>. However, it is unclear, what <code>number</code> is supposed to be.</p>
  <p>Judging by the error message, it seems that <code>number</code> isn't actually a discrete value(?!) like <code>Number</code>. But despite this, it is used in variable and function declarations as if it is a value, like:</p>
  <pre class="lang-js prettyprint-override"><code>var two: number = 2;
  function sqr(x: number) { return x; }
  </code></pre>
  <p>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, <code>Number</code> can be used in annotations similar to <code>number</code>:</p>
  <pre class="lang-js prettyprint-override"><code>var two: Number = 2;
  </code></pre>
  <p>There is similar cases with <code>string</code> and <code>String</code>, <code>any</code> and <code>Object</code>, etc.</p>
  <p>So, my question is: <strong>What are <code>number</code>, <code>string</code>, etc in TypeScript, and how are they different then built-in constructors?</strong></p>