title: Use multiple generic parameters as object keys in TypeScript
body: <p>Is there a way to use <strong>multiple generic parameters</strong> as object keys in TypeScript?<br />
  <a href="https://stackoverflow.com/a/56419609/7709086">The answer I found here</a> works fine when there is only one parameter, but not when there is more. The error &quot;A mapped type may not declare properties or methods&quot; appears if I try to declare more than one <code>[key in T]</code>.</p>
  <p>A class I have for example:</p>
  <pre class="lang-js prettyprint-override"><code>export class DynamicForm&lt;
      K0 extends string, V0,
      K1 extends string, V1,
      ...
  &gt; {
      public get value(): {
          [key in K0]: V0;
          [key in K1]: V1; // ERROR: A mapped type may not declare properties or methods. ts(7061)
          ...
      } {
          // returning value...
      }
  
      public constructor(
          input0?: InputBase&lt;K0, V0&gt;,
          input1?: InputBase&lt;K1, V1&gt;,
          ...
      ) {
          // doing stuff...
      }
  
  }
  </code></pre>
  <p>Basically I want to be able to return a typed value based on the generic types given in the constructor.</p>
  <p>I could use a <code>[key in ClassWithAllKeys]</code>, but then I think I would lose the connection between <code>K0 &lt;=&gt; V0</code>, <code>K1 &lt;=&gt; V1</code>, etc.</p>