title: typescript: how to set computed property as keyof...?
body: <p>i can't figure out why this code doesn't compile with TypeScript@2.6.2</p>
  
  <pre><code>class TestClass&lt;T extends object, K extends keyof T&gt;
  {
      [key:K]:T[K];
  
      constructor(value:T)
      {
          Object.assign(this, value);
      }
  }
  </code></pre>
  
  <p>this the error message for <code>[key:K]:T[K]</code>;</p>
  
  <p><strong><em>Error:(3, 6) TS1023: An index signature parameter type must be 'string' or 'number'.</em></strong></p>
  
  <p>someone can help?</p>
  
  <p>i get the same error also with:</p>
  
  <pre><code>class Options&lt;T extends object&gt;
  {
      [K in keyof T]:T[K];
  
      constructor(value:T)
      {
          Object.assign(this, value);
      }
  }
  </code></pre>
  
  <p>but i get these errors:</p>
  
  <pre><code>Error:(3, 5) TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
  Error:(3, 6) TS2304: Cannot find name 'K'.
  Error:(3, 11) TS2304: Cannot find name 'keyof'.
  Error:(3, 17) TS2663: Cannot find name 'T'. Did you mean the instance member 'this.T'?
  Error:(3, 22) TS2304: Cannot find name 'K'.
  Error:(3, 17) TS1005: ']' expected.
  Error:(3, 18) TS1005: ';' expected.
  Error:(3, 19) TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
  Error:(3, 21) TS1005: '=' expected.
  </code></pre>