title: Typescript dynamic class functions from generics
body: <p>I want to do something like</p>
  <pre><code>class C&lt;R extends Record&lt;string, unknown&gt;&gt; {
    [K extends keyof R](param: R[K]) {
      console.log(K, param); // have access to both key and value
    }
  }
  </code></pre>
  <p>Is there a way to achieve this with typescript?</p>
  <p>Currently I have something like</p>
  <pre><code>class C&lt;R extends Record&lt;string, unknown&gt;&gt; {
    f&lt;K extends keyof R&gt;(k: K, param: R[K]) {
      console.log(k, param);
    }
  }
  </code></pre>
  <p>and I want to see if I can get rid of the <code>f</code> since it's redundant/semantically not useful in my use case.</p>
  <p>I read <a href="https://stackoverflow.com/questions/51026068/typescript-auto-generated-dynamic-function-names">this</a> post, but it only generates the names and not the implementations of the functions.</p>