title: how to declare member variable as extended type in TypeScript?
body: <p>Is there a way to define a "member variable" as an "extension object" instead of a static type (without using an interface)? </p>
  
  <p>Simply something like this pseudocode:</p>
  
  <pre><code>class Foo {
  
      bar -&gt; extends Rectangle;
      constructor(barInstance:IRectangle){
         this.bar = barInstance;
  
         this.bar.getArea(); //&lt;-- is code completed because interface IRectangle
  
         // no type error
         this.bar.someCustomFunction = function() {
         }
      }
  
  }
  </code></pre>
  
  <p>instead of </p>
  
  <pre><code>class Foo {
      bar: IRectangle;
      //or
      bar:Rectangle;
  }
  </code></pre>
  
  <p>This way I can add properties not defined on the base class or interface without getting type errors, but also get code completion from the base class. Heh, <em>lazy</em> strict typing?</p>