title: How to work with form elements in typescript
body: <p>I'd like to access form elements via <code>myForm.elements</code>, and then access each element by it's name, for example, <code>myForm.elements.month</code>. Typescript doesn't like this b/c it doesn't know that <code>form.elements</code> contains a property of <code>month</code>. I thought, let's create an interface! So I did, (see code below), but I'm getting this typescript error: <code>Neither type 'HTMLCollection' nor type 'FormElements' is assignable to the other</code></p>
  
  <p>Here's the code I'm working with: </p>
  
  <pre><code>interface FormElements {
      day: HTMLInputElement;
      month: HTMLInputElement;
      year: HTMLInputElement;
  }
  
  class BirthdateInput {
      constructor(form: HTMLFormElement) {
          var elements: FormElements = &lt;FormElements&gt; form.elements; // error here
  
          this.day = elements.day;
          this.month = elements.month;
          this.year = elements.year;
      }
  }
  </code></pre>
  
  <p>Any ideas on how to better cast my <code>form.elements</code> object so typescript won't complain?</p>