<p dir="auto">Hi!</p>
<p dir="auto">I'm using TypeScript with named parameters massively like this.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="class User {
  public firstName: string;
  public lastName: string;
  constructor({firstName, lastName}: {firstName: string, lastName: string}) {
    this.firstName = firstName;
    this.lastName = lastName;
  }
}

new User({firstName: 'Foo', lastName: 'BAR'});"><pre class="notranslate"><code class="notranslate">class User {
  public firstName: string;
  public lastName: string;
  constructor({firstName, lastName}: {firstName: string, lastName: string}) {
    this.firstName = firstName;
    this.lastName = lastName;
  }
}

new User({firstName: 'Foo', lastName: 'BAR'});
</code></pre></div>
<p dir="auto">And I would love to be able to generate the properties automatically like this.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="class User {
  constructor({public firstName, public lastName}: {firstName: string, lastName: string}) {}
}

new User({firstName: 'Foo', lastName: 'BAR'});"><pre class="notranslate"><code class="notranslate">class User {
  constructor({public firstName, public lastName}: {firstName: string, lastName: string}) {}
}

new User({firstName: 'Foo', lastName: 'BAR'});
</code></pre></div>
<p dir="auto">I think that this feature can be really interesting and would encourage more developers to use named parameters which I think is one of the most important best practices in TypeScript and any other language by the way.</p>
<p dir="auto">Thank you in advance.</p>
<p dir="auto">Today, we can take advantage of parameter properties to reduce the boilerplate, e.g:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Person {
  constructor(public firstName: string, public lastName: number, public age: number) {

  }
}"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-smi">Person</span> <span class="pl-kos">{</span>
  <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-k">public</span> <span class="pl-s1">firstName</span>: <span class="pl-smi">string</span><span class="pl-kos">,</span> <span class="pl-k">public</span> <span class="pl-s1">lastName</span>: <span class="pl-smi">number</span><span class="pl-kos">,</span> <span class="pl-k">public</span> <span class="pl-s1">age</span>: <span class="pl-smi">number</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>

  <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Since 1.5, we can also use destructuring, e.g:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Person {
  firstName: string;
  lastName: string;
  age: number;

  constructor({ firstName, lastName, age } : { firstName: string, lastName: string, age: number }) {
    this.firstName = firstName;
    this.lastName = lastName;
    this.age = age;
  }
}"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-smi">Person</span> <span class="pl-kos">{</span>
  <span class="pl-c1">firstName</span>: <span class="pl-smi">string</span><span class="pl-kos">;</span>
  <span class="pl-c1">lastName</span>: <span class="pl-smi">string</span><span class="pl-kos">;</span>
  <span class="pl-c1">age</span>: <span class="pl-smi">number</span><span class="pl-kos">;</span>

  <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-kos">{</span> firstName<span class="pl-kos">,</span> lastName<span class="pl-kos">,</span> age <span class="pl-kos">}</span> : <span class="pl-kos">{</span> <span class="pl-c1">firstName</span>: <span class="pl-smi">string</span><span class="pl-kos">,</span> <span class="pl-c1">lastName</span>: <span class="pl-smi">string</span><span class="pl-kos">,</span> <span class="pl-c1">age</span>: <span class="pl-smi">number</span> <span class="pl-kos">}</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">firstName</span> <span class="pl-c1">=</span> <span class="pl-s1">firstName</span><span class="pl-kos">;</span>
    <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">lastName</span> <span class="pl-c1">=</span> <span class="pl-s1">lastName</span><span class="pl-kos">;</span>
    <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">age</span> <span class="pl-c1">=</span> <span class="pl-s1">age</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">I've tried in many ways to combine both features, but had no success. So:</p>
<ol dir="auto">
<li>Is it possible to combine them nowadays, and if yes, how?</li>
<li>If not, could it be an improvement to a future TypeScript version? E.g:</li>
</ol>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Person {
  constructor(public { firstName, lastName, age } : { firstName: string, lastName: string, age: number }) {

  }
}

// the code above would possibly transpile to:
var Person = (function () {
    function Person(_a) {
        var firstName = _a.firstName, lastName = _a.lastName, age = _a.age;
        this.firstName = firstName;
        this.lastName = lastName;
        this.age = age;
    }
    return Person;
})();"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-v">Person</span> <span class="pl-kos">{</span>
  <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-s1">public</span> <span class="pl-kos">{</span> firstName<span class="pl-kos">,</span> lastName<span class="pl-kos">,</span> age <span class="pl-kos">}</span> : <span class="pl-kos">{</span> <span class="pl-c1">firstName</span>: <span class="pl-s1">string</span><span class="pl-kos">,</span> <span class="pl-c1">lastName</span>: <span class="pl-s1">string</span><span class="pl-kos">,</span> <span class="pl-c1">age</span>: <span class="pl-s1">number</span> <span class="pl-kos">}</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>

  <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-c">// the code above would possibly transpile to:</span>
<span class="pl-k">var</span> <span class="pl-v">Person</span> <span class="pl-c1">=</span> <span class="pl-kos">(</span><span class="pl-k">function</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">function</span> <span class="pl-v">Person</span><span class="pl-kos">(</span><span class="pl-s1">_a</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-k">var</span> <span class="pl-s1">firstName</span> <span class="pl-c1">=</span> <span class="pl-s1">_a</span><span class="pl-kos">.</span><span class="pl-c1">firstName</span><span class="pl-kos">,</span> <span class="pl-s1">lastName</span> <span class="pl-c1">=</span> <span class="pl-s1">_a</span><span class="pl-kos">.</span><span class="pl-c1">lastName</span><span class="pl-kos">,</span> <span class="pl-s1">age</span> <span class="pl-c1">=</span> <span class="pl-s1">_a</span><span class="pl-kos">.</span><span class="pl-c1">age</span><span class="pl-kos">;</span>
        <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">firstName</span> <span class="pl-c1">=</span> <span class="pl-s1">firstName</span><span class="pl-kos">;</span>
        <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">lastName</span> <span class="pl-c1">=</span> <span class="pl-s1">lastName</span><span class="pl-kos">;</span>
        <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">age</span> <span class="pl-c1">=</span> <span class="pl-s1">age</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
    <span class="pl-k">return</span> <span class="pl-v">Person</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>