tests/cases/compiler/typeVariableTypeGuards.ts(33,5): error TS2416: Property 'render' in type 'BigMonkey' is not assignable to the same property in base type 'Monkey<BigBanana>'.
  Type '() => void' is not assignable to type '() => void'. Two different types with this name exist, but they are unrelated.
    The 'this' types of each signature are incompatible.
      Type 'Monkey<T>' is not assignable to type 'BigMonkey'.
        Types of property 'render' are incompatible.
          Type '() => void' is not assignable to type '() => void'. Two different types with this name exist, but they are unrelated.
            The 'this' types of each signature are incompatible.
              Type 'BigMonkey' is not assignable to type 'Monkey<T>'.
                Types of property 'a' are incompatible.
                  Type 'BigBanana' is not assignable to type 'T'.
                    'BigBanana' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Banana | undefined'.


==== tests/cases/compiler/typeVariableTypeGuards.ts (1 errors) ====
    // Repro from #14091
    
    interface Foo {
        foo(): void
    }
    
    class A<P extends Partial<Foo>> {
        constructor(public props: Readonly<P>) {}
        doSomething() {
            this.props.foo && this.props.foo()
        }
    }
    
    // Repro from #14415
    
    interface Banana {
        color: 'yellow';
    }
    
    class Monkey<T extends Banana | undefined> {
        constructor(public a: T) {}
        render() {
            if (this.a) {
                this.a.color;
            }
        }
    }
    
    interface BigBanana extends Banana {
    }
    
    class BigMonkey extends Monkey<BigBanana> {
        render() {
        ~~~~~~
!!! error TS2416: Property 'render' in type 'BigMonkey' is not assignable to the same property in base type 'Monkey<BigBanana>'.
!!! error TS2416:   Type '() => void' is not assignable to type '() => void'. Two different types with this name exist, but they are unrelated.
!!! error TS2416:     The 'this' types of each signature are incompatible.
!!! error TS2416:       Type 'Monkey<T>' is not assignable to type 'BigMonkey'.
!!! error TS2416:         Types of property 'render' are incompatible.
!!! error TS2416:           Type '() => void' is not assignable to type '() => void'. Two different types with this name exist, but they are unrelated.
!!! error TS2416:             The 'this' types of each signature are incompatible.
!!! error TS2416:               Type 'BigMonkey' is not assignable to type 'Monkey<T>'.
!!! error TS2416:                 Types of property 'a' are incompatible.
!!! error TS2416:                   Type 'BigBanana' is not assignable to type 'T'.
!!! error TS2416:                     'BigBanana' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Banana | undefined'.
            if (this.a) {
                this.a.color;
            }
        }
    }
    
    // Another repro
    
    type Item = {
        (): string;
        x: string;
    }
    
    function f1<T extends Item | undefined>(obj: T) {
        if (obj) {
            obj.x;
            obj["x"];
            obj();
        }
    }
    
    function f2<T extends Item | undefined>(obj: T | undefined) {
        if (obj) {
            obj.x;
            obj["x"];
            obj();
        }
    }
    
    function f3<T extends Item | undefined>(obj: T | null) {
        if (obj) {
            obj.x;
            obj["x"];
            obj();
        }
    }
    
    function f4<T extends string[] | undefined>(obj: T | undefined, x: number) {
        if (obj) {
            obj[x].length;
        }
    }
    
    function f5<T, K extends keyof T>(obj: T | undefined, key: K) {
        if (obj) {
            obj[key];
        }
    }
    