title: Object with arbitrary properties as class property
body: <p>I am just starting out with Typescript, and I cannot understand if it's possible to have a class property be an object, which would hold any arbitrary property in addition to properties declared in the class. For example, I defined here a <code>name</code> as a property of a <code>Person</code>, and then under <code>properties</code> you should be able to define any other arbitrary characteristics for the person, such as their height. It seems that assigning it goes okay, but trying to access it on line 12 throws an error saying: </p>
  
  <blockquote>
    <p>Property 'height' does not exist on type 'Object'</p>
  </blockquote>
  
  <p>Fair enough! I know there is no guarantee that a property named <code>height</code> would be under something that is just an object, but there should still be a way to do this. </p>
  
  <p>Here is the code:</p>
  
  <pre><code>class Person {
      public name: string;
      public properties: Object; 
      constructor(name: string, other: Object) {
          this.name = name;
          this.properties = other;
      }
  }
  
  let props: Object = { height: 200 };
  var nick = new Person("Bob", props);
  console.log(nick.properties.height);
  </code></pre>
  
  <p>And here is an alternative I've tried, which throws exactly the same error: </p>
  
  <pre><code>class Person {
      public name: string;
      public properties: Object; 
      constructor(name: string, other:{ height: number }) {
          this.name = name;
          this.properties = other;
      }
  }
  
  
  var nick = new Person("Bob", { height: 200 });
  console.log(nick.properties.height);
  </code></pre>
  
  <p>Another alternative with an interface I've just tried, that still doesn't work.</p>
  
  <pre><code>interface PersonProperties {
      height: number;
  }
  
  class Person {
      public name: string;
      public properties: Object; 
      constructor(name: string, other: PersonProperties) {
          this.name = name;
          this.properties = other;
      }
      getHeight(): number {
          return this.properties.height;
      }
  }
  
  var properties: PersonProperties = { height: 200 }; 
  var nick = new Person("Bob", properties);
  document.write(nick.getHeight().toString());
  </code></pre>