title: Generic type for all class methods names with return type
body: <p>I am attempting to create a generic which will give me information about all class methods return types (+ fields, but they are not that important).</p>
  <p>Let's say I have created such a class:</p>
  <pre class="lang-js prettyprint-override"><code>class TestClass {
      testField: string;
  
      constructor() {
          this.testField = 'test';
      }
  
      testMethod1(param: number): number {
          return param;
      }
  
      testMethod2(param: string): string {
          return param;
      }
  
  }
  </code></pre>
  <p>As the result, I would like to have such type:</p>
  <pre class="lang-js prettyprint-override"><code>interface TestClassMethodsNamesReturnType {
    testMethod1: number;
    testMethod2: string;
  }
  </code></pre>
  <h3>What I have tried so far</h3>
  <ul>
  <li><p>mapping types + types inference:</p>
  <p><strong>Example 1</strong></p>
  <pre class="lang-js prettyprint-override"><code>export type ClassMethodsNamesReturnType&lt;T extends Function&gt; = {
      [k in keyof T['prototype']]: ReturnType&lt;T['prototype'][k]&gt;;
  }
  
  const x: ClassMethodsNamesReturnType&lt;TestClass&gt; = {
      //...
  }
  </code></pre>
  <p>Error:</p>
  <blockquote>
  <p>Type 'TestClass' is missing the following properties from type 'Function': apply, call, bind, prototype, and 5 more</p>
  </blockquote>
  </li>
  <li><p>mapping types and treat class as object:</p>
  <p><strong>Example 2</strong></p>
  <pre class="lang-js prettyprint-override"><code>// I think here I can have problems to decide is the key of my class is a field or method 
  // what can be a problematic to decide what I should use (typeof T[K] or ReturnType&lt;typeof T[K]&gt;)
  export type ClassMethodsNamesReturnType&lt;T extends Record&lt;string, T[K]&gt;, K extends keyof T&gt; = {
      [K]: T[K];
  }
  </code></pre>
  <p>Error:</p>
  <blockquote>
  <p>A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type</p>
  </blockquote>
  <blockquote>
  <p>'K' only refers to a type, but is being used as a value here</p>
  </blockquote>
  </li>
  </ul>
  <p>Do you have any hints or ideas how can I achieve this?</p>