title: TypeScript type casting a string with as operator
body: <pre><code>function doSomething(a : any) {
      let b = (a as Array&lt;any&gt;)
      alert(typeof b) // gives "string"
  }
  
  doSomething("Hello")
  </code></pre>
  
  <p>The alert shows "string". What I expected was something like a <code>null</code>. I haven't found much documentation on the <code>as</code> operator. Maybe <a href="https://github.com/Microsoft/TypeScript/wiki/What&#39;s-new-in-TypeScript#new-tsx-file-extension-and-as-operator" rel="nofollow noreferrer">this</a> is the "official" one.</p>
  
  <p>Here is <a href="https://stackoverflow.com/questions/34032303/typescript-type-casting-not-working">a related quetion</a>.</p>
  
  <p>Do I still have to check the type of <code>b</code> myself?</p>