title: How can you declare new properties on a class from an external module?
body: <p>I see that declaration merging allows me to declare new methods on classes from external modules, which I can define by assigning a function to a property on the class's prototype:</p>
  
  <pre><code>import { Observable } from "./observable";
  declare module "./observable" {
      interface Observable&lt;T&gt; {
          map&lt;U&gt;(f: (x: T) =&gt; U): Observable&lt;U&gt;;
      }
  }
  Observable.prototype.map = function (f) {
      // ... another exercise for the reader
  }
  </code></pre>
  
  <p>What I want instead is to declare new <em>properties</em> on the class, which I may either assign directly or define with <code>Object.defineProperty</code>:</p>
  
  <pre><code>import { Observable } from "./observable";
  declare module "./observable" {
      interface Observable&lt;T&gt; {
          name: string;
      }
  }
  Object.defineProperty(Observable.prototype, 'name', {
      get: function getName () {
          return 'whatever I want'
      }
  }
  </code></pre>
  
  <p>Is there any way to do this?</p>