title: Typescript error: An outer value of 'this' is shadowed by this container
body: <p>I had an error in a Typescript class method declaration, but I don't understand how the error message relates back to the bug. </p>
  
  <p>The message seems to be saying that 'this' is of type <code>any</code>, but we are in a class definition, and so I thought 'this' was really clear.</p>
  
  <p>Can someone please explain how the error message relates back to the bug?</p>
  
  <p>Original method:</p>
  
  <pre><code>calcSize = function() {
      return this.width * this.length; // Error on this line
  };
  
  // Error text: 'this' implicitly has type 'any' because it does not 
  //have a type annotation.ts(2683)
  //app.ts(39, 16): An outer value of 'this' is shadowed by this container.
  </code></pre>
  
  <p>fix:</p>
  
  <pre><code>calcSize() {
      return this.width * this.length;
  };
  </code></pre>
  
  <p>Full context (fixed):</p>
  
  <pre><code>class BaseObject {
      constructor(
          public width: number = 0,
          public length: number = 0
          ) {}
  
  };
  
  class Rectangle extends BaseObject {
  
      constructor(public width: number = 0, public length: number = 0) {
          super(width, length);
      }
  
      calcSize() {
          return this.width * this.length;
      };
  }
  </code></pre>