title: Is there a `valueof` similar to `keyof` in TypeScript?
body: <p>I want to be able to assign an object property to a value given a key and value as inputs yet still be able to determine the type of the value. It's a bit hard to explain so this code should reveal the problem:</p>
  
  <pre><code>type JWT = { id: string, token: string, expire: Date };
  const obj: JWT = { id: 'abc123', token: 'tk01', expire: new Date(2018, 2, 14) };
  
  function print(key: keyof JWT) {
      switch (key) {
          case 'id':
          case 'token':
              console.log(obj[key].toUpperCase());
              break;
          case 'expire':
              console.log(obj[key].toISOString());
              break;
      }
  }
  
  function onChange(key: keyof JWT, value: any) {
      switch (key) {
          case 'id':
          case 'token':
              obj[key] = value + ' (assigned)';
              break;
          case 'expire':
              obj[key] = value;
              break;
      }
  }
  
  print('id');
  print('expire');
  onChange('id', 'def456');
  onChange('expire', new Date(2018, 3, 14));
  print('id');
  print('expire');
  
  onChange('expire', 1337); // should fail here at compile time
  print('expire'); // actually fails here at run time
  </code></pre>
  
  <p>I tried changing <code>value: any</code> to <code>value: valueof JWT</code> but that didn't work.</p>
  
  <p>Ideally, <code>onChange('expire', 1337)</code> would fail because <code>1337</code> is not a Date type.</p>
  
  <p>How can I change <code>value: any</code> to be the value of the given key?</p>