title: Combining the Parameter Properties shorthand with Destructuring in TypeScript
body: <h2>EDIT</h2>
  
  <p>I logged <a href="https://github.com/Microsoft/TypeScript/issues/5326" rel="noreferrer">an issue on TypeScript's Github repo</a> and they're accepting PRs for implementing it.</p>
  
  <hr>
  
  <p>In TypeScript, when we want to automatically create properties in our class from the constructor definition, we can take advantage of the Parameter Properties shorthand, e.g:</p>
  
  <pre><code>class Person {
      constructor(public firstName : string, public lastName : number, public age : number) {
  
      }
  }
  </code></pre>
  
  <p>And then, the transpiled Javascript will be:</p>
  
  <pre><code>var Person = (function () {
      function Person(firstName, lastName, age) {
          this.firstName = firstName;
          this.lastName = lastName;
          this.age = age;
      }
      return Person;
  })();
  </code></pre>
  
  <hr>
  
  <p>But if we want to receive an object in our constructor, it would be something like:</p>
  
  <pre><code>interface IPerson {
      firstName : string,
      lastName : string,
      age: number
  }
  
  class Person {
      constructor(person : IPerson) {
          this.firstName = person.firstName;
          this.lastName = person.lastName;
          this.age = person.age;
      }
  }
  </code></pre>
  
  <p>Since TypeScript 1.5, we can take advantage of destructuring, e.g:</p>
  
  <pre><code>class Person {
      constructor({firstName, lastName, age} : {firstName: string, lastName: string, age: number}) {
          this.firstName = firstName;
          this.lastName = lastName;
          this.age = age;
      }
  }
  </code></pre>
  
  <hr>
  
  <p><strong>Question</strong>: How to combine the Parameter Properties shorthand and Destructuring in TypeScript?</p>
  
  <p>I've tried to define <code>public</code> before the object definition, e.g:</p>
  
  <pre><code>class Person {
      constructor(public {firstName, lastName, age} : {firstName: string, lastName: string, age: number}) {
  
      }
  }
  </code></pre>
  
  <p>Tried to define it before each variable, e.g:</p>
  
  <pre><code>class Person {
      constructor({public firstName, public lastName, public age} : {firstName: string, lastName: string, age: number}) {
  
      }
  }
  </code></pre>
  
  <p>But I had no success. Any thoughts?</p>