title: How to convert numeric strings in objects to numbers using typescript types
body: <p>Here's the problem. Lets say I have the following object:</p>
  
  <pre><code>const x = {
      number1: '1',
      number2: '2',
      string1: 'one',
  }
  </code></pre>
  
  <p>And the following typescript type.</p>
  
  <pre><code>class params {
      number1: number;
      number2: number;
      string1: string;
  }
  </code></pre>
  
  <p>Is there an elegant way to convert the <code>x</code> object to the <code>params</code> type such that the properties <code>number1</code> and <code>number2</code> are cast from strings in <code>x</code> to numbers as defined by <code>params</code>?</p>