title: Allow any input string when class is instantiated without a generic in TypeScript
body: <p>Consider the following class and types:</p>
  <pre><code>type keyCollection = {
    [key: string]: {
        request: any,
        response: any
    }
  }
  
  class myTest&lt;TData extends keyCollection = any&gt; {
    testFunction&lt;
      TInput extends keyof TData, 
      TObject = TData extends keyCollection ? TData[TInput]['request'] : any&gt;(input: TInput, data: TObject) {}
  }
  </code></pre>
  <p>My goal is, that if this class is instantiated without any generic parameter, the <code>testFunction</code> should accept any <code>string</code> as it's first parameter, and anything as it's second parameter. Yet, when a generic is passed to the class, it should constrain the values of the <code>testFunction</code>.</p>
  <p>Here are some test cases:</p>
  <pre><code>let a: myTest = new myTest();
  a.testFunction('test', {}); // works as expected, no generic parameter for the class, thus accepts string as first parameter, and any as second
  
  
  type testGenericKeyCollection = {
    a: {
      'request': string,
      'response': any
    },
    b: {
      'request': string,
      'response': any
    }
  }
  let b: myTest&lt;testGenericKeyCollection&gt; = new myTest();
  b.testFunction(&quot;c&quot;, 25); // correctly errors out, as &quot;c&quot; as not a property of 
  b.testFunction(&quot;a&quot;, 25); // why no error here? 25 is type number not type string - also, why no type helping here?
  </code></pre>
  <p>As you can see in the comments, the instantiation without generic seems to work in the first test case - the function accepts any string as it's first parameter, and anything as it's second parameter.</p>
  <p>As for the second case, it still is ok, when the class is instantiated with a generic type provided, <code>testFunction</code> does not accept &quot;c&quot; as it's first parameter anymore, because it is not a property of the provided generic.</p>
  <p>Yet, for the third test-case, while it correctly identifies the key from the input, it allows any type as the second parameter, and I can't figure out why. The third test-case should only accept a <code>string</code> type as it's second parameter.</p>
  <p>Why is this not working the way I am expecting it to work?</p>
  <p>Fiddle <a href="https://www.typescriptlang.org/play?ssl=14&amp;ssc=1&amp;pln=30&amp;pc=115#code/C4TwDgpgBA1hIGED2AbFEDGwCWSB2UAvFAN4CwAUFFANpwgBcUAzsAE7Z4DmAuk%20VWpC2EAI4BXCKyYBDPCAA0lIcKlh8zCLPnKoAX0oGKlDChnNmUALYgAKlOAAeWwBEZwGVAgAPYBDwAJpb0yGiYOPhEUHIgAHykun6sAGLieFi4eI661LYAknhg4sBevv5BsPBIAGZQru4yClA5dQDyAEYAVuFR9R6lfoHB8KHoGZEA-HVuHjT5hcU8NADkIhIOyzxQ2nEAFJxFwEzzh00BDccd3VgAlKRGRpToJTJMNvasUXgQAO7Wdg5djcANyUGQAOiSwFS6QieF2yyhyyaJD0IKgAHoMVAfkg2DBLOZSpAsBAAk08EgoFx-BAOBgoGAZGwZFYIH42FBqnioMAABbQUzmZhNfniQkYDAQMDASysDjcaKWarYNifJkstkcppyALReRKliYfABShmiigSC8hwAcVp9IA0iNUGM4VEBNRXglBNRVmJJKxlkx5ZwuEofVA-cx1HhNEH9SBdHpw9R2vwWn71oHg%20xQymhFGY3GdknDE92VA0-8Pk4oXbvo7nWFxnh4sRvn93oCQZR2pCHDCW7sAEQYYdNABMAFZ0VioBg8SIsCgQF42Gw8ZYkMUdZZR8PDZSXoyN5A2KAoDVmhQ%201DB3CRzJx1Bp7PsT8%20avKWuN5yBSIpmnKBsEsS1oDwcQrHaOkoCPXlwGgENFQAWmiFBmCQJoPy-KkwKgAUUDAUN8LpCAJiAA" rel="nofollow noreferrer">here</a></p>