protectedAccessThroughContextualThis.ts(13,20): error TS2341: Property 'privat' is private and only accessible within class 'Foo'.
protectedAccessThroughContextualThis.ts(20,20): error TS2341: Property 'privat' is private and only accessible within class 'Foo'.


==== protectedAccessThroughContextualThis.ts (2 errors) ====
    class Foo {
      protected protec = 'bar';
      private privat = '';
      copy!: string
      constructor() {
        bindCopy.call(this)
        bindCopy2.call(this)
      }
    }
    
    function bindCopy(this: Foo) {
      this.copy = this.protec; // Should OK
      console.log(this.privat); // Should error
                       ~~~~~~
!!! error TS2341: Property 'privat' is private and only accessible within class 'Foo'.
    }
    
    type BindingFunction = (this: Foo) => void;
    
    const bindCopy2: BindingFunction = function () {
      this.copy = this.protec; // Should OK
      console.log(this.privat); // Should error
                       ~~~~~~
!!! error TS2341: Property 'privat' is private and only accessible within class 'Foo'.
    }