Repository: TypeScript
Issue: TS2345 when calling a superclass' method with a conditional type parameter from a parameterized subclass
Labels: Bug

<!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨

Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Even if you think you've found a *bug*, please read the FAQ first, especially the Common "Bugs" That Aren't Bugs section!

Please help us by doing the following steps before logging an issue:
  * Search: https://github.com/Microsoft/TypeScript/search?type=Issues
  * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ

Please fill in the *entire* template below.
-->

<!--
Please try to reproduce the issue with the latest published version. It may have already been fixed.
For npm: `typescript@next`
This is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly
-->
**TypeScript Version:**  3.8.3 & 4.0.0-dev.20200506

<!-- Search terms you tried before logging this (so others can find this issue more easily) -->
**Search Terms:** TS2345 generic constructor super superclass method type parameter inheritance conditional type constraint

**Code**

```ts
type FilterKeysOf<T, Condition> = { [K in keyof T]: T[K] extends Condition ? K : never }[keyof T];

type ArrayKeysOf<T> = FilterKeysOf<T, readonly unknown[]>;

interface I {
  foo: string;
  bar: string[];
  baz: number;
}

interface J extends I {
  qux: boolean[];
}

class A<T extends I> {
  protected treasure: T

  constructor(treasure: T) {
    this.treasure = treasure;
  }

  getArrayTreasure<K extends ArrayKeysOf<T>>(fieldName: K): T[K] {
    return this.treasure[fieldName];
  }
}

class B<T extends J> extends A<T> {
  getQuxArrayTreasure(): boolean[] {
    return super.getArrayTreasure('qux');
  }
}

class C extends B<J> {
  anyQux(): boolean {
    return super.getArrayTreasure('qux').some(Boolean);
  }
}

```

**Expected behavior:**
Compiles without errors.

**Actual behavior:**
TS v3.8.3:
```
foo.ts:25:35 - error TS2345: Argument of type '"qux"' is not assignable to parameter of type 'T[keyof T] extends readonly unknown[] ? keyof T : never'.

25     return super.getArrayTreasure('qux');
                                     ~~~~~


Found 1 error.
```
TS v4.0.0-dev.20200506:
```
foo.ts:25:5 - error TS2322: Type 'T[{ [K in keyof T]: T[K] extends readonly unknown[] ? K : never; }[keyof T]]' is not assignable to type 'boolean[]'.
  Type 'T[T[keyof T] extends readonly unknown[] ? keyof T : never]' is not assignable to type 'boolean[]'.
    Type 'T[keyof T]' is not assignable to type 'boolean[]'.
      Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'boolean[]'.
        Type 'T[string]' is not assignable to type 'boolean[]'.

25     return super.getArrayTreasure('qux');

foo.ts:25:35 - error TS2345: Argument of type '"qux"' is not assignable to parameter of type 'T[keyof T] extends readonly unknown[] ? keyof T : never'.

25     return super.getArrayTreasure('qux');
                                     ~~~~~


Found 2 errors.
```

**Playground Link:** <!-- A link to a TypeScript Playground "Share" link which demonstrates this behavior -->
[Link](https://www.typescriptlang.org/play/?module=1&ssl=1&ssc=1&pln=38&pc=1#code/C4TwDgpgBAYglgG2BATgaQiAzgeQGYA8AKgDRQDCA9gHYAmcwcNAfFALxQDeUA2mlHGpQA1pkp4oRALoAuSXylQIAD2R0sFGvUY0oAfij851CADdUUAL49RIcZKkBuAFDPQkKAEEUKAIYgMbHxiVg54JFRA3EJSKBQIX1oaBBAoAFdqYWpKAHdqHilmF2dBZBQ8XwBjaABJLmcoKDxKSjksYBRBAHMXRoAjXxQ2ju6C3qgBgC9jNIBbPtQXS1dS1ArqqAApJVUIdSg6zgaoAEc05Tk+loQE-KdnZedKhF8sDU9iHbVaDRrWI8aYBQlGQlWQtCgHQSWDS8TkRFcjUqNHaKDSYMoKAAFFDXrCIPCAJT1RqNYAACzgWAAdLiYfF2JD4nj4uNHo0uhBgN4-CAiMz6RACPwVN93j5-FFgkRmMwsXg4BAELQAHK+WYEwyE+EKEmk+LAWFCClU2kC-E8BVK1XqiD3RrLR7PV4aABCn1Fex+W1Ynv2Hxles5wAAiucef5+dD8VjtRNrrcCnrGgajVAYZAUNTgxG+eb4liAORnZSFwlsh6uZ1vChfL1ugibf7HXzUEBh5Sxy4J1vJuJctMZ1DZrm5qMsiBFktl6lYSgarGunvUcvHR3OIA)
**Related Issues:** <!-- Did you find other bugs that looked similar? -->