title: How to construct TypeScript object with HTML input values?
body: <p>This should be very basic but I am unable to get through it.</p>
  
  <p>I have a class like: </p>
  
  <pre><code>class MyObject {
      value: number;
      unit: string; 
  
      constructor(value: number, unit: string){
           this.value = value;
           this.unit = unit;
      }
  }
  </code></pre>
  
  <p>Then in HTML,</p>
  
  <pre><code>    &lt;input id="myValue" type="number"&gt;&lt;/input&gt;
      &lt;input id="myUnit" type="text"&gt;&lt;/input&gt;
  </code></pre>
  
  <p>I want to create an Object of "MyObject" class using myValue and myUnit. How do I do that ?</p>
  
  <p>Something like: </p>
  
  <pre><code>    var value = document.getElementById("myValue");
      var unit = document.getElementById("myUnit"); 
      myObject: MyObject = new MyObject(value, unit);
  </code></pre>
  
  <p>Unable to do it the above way. What's the way to go about with this ?</p>