title: Casting a number to a string in TypeScript
body: <p>Which is the the best way (if there is one) to cast from number to string in Typescript?</p>
  
  <pre><code>var page_number:number = 3;
  window.location.hash = page_number; 
  </code></pre>
  
  <p>In this case the compiler throws the error:</p>
  
  <blockquote>
    <p>Type 'number' is not assignable to type 'string'</p>
  </blockquote>
  
  <p>Because <code>location.hash</code> is a string.</p>
  
  <pre><code>window.location.hash = ""+page_number; //casting using "" literal
  window.location.hash = String(number); //casting creating using the String() function
  </code></pre>
  
  <p>So which method is better?</p>