title: Typescript loose typing in destructuring assignment
body: <p>When using destructuring assignment and variable as property name Typescript seems like loses types.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>interface O {
      [val: string]: string;
  }
  
  const o: O = {
      foo: ''
  };
  
  const f = (name: string) =&gt; {
      const {[name]: value} = o;
      // now `value` has type any, how to make it type `string`?
  
      const value1 = o[name] || '';
      // and `value1` has correct type `string`
  };</code></pre>
  </div>
  </div>
  </p>