cast operator indicates to the compiler that we know the specific type of a value better than the compiler are able to.
For example, if we fetch a HTML-element through document.getElementById(), the compiler can only know that the return value is of type Element. However, we may know that the returned element is actually a HTMLInputElement because we know how the page is layed out.
Example:
// this will not compile var name : HTMLInputElement = document.getElementById("x"); // but this works var name : HTMLInputElement = document.getElementById("x") cast HTMLInputElement;
Of course we have to be confident that the element actually is a HTMLInputElement. Otherwise we will get erroneous behavior.
