shorten constructor

This commit is contained in:
cupcakearmy 2019-10-09 09:54:47 +02:00
parent e3e331ddf8
commit d277b69614

View File

@ -466,24 +466,6 @@
}
</code></pre>
</section>
<section>
<h3>Advanced Stuff</h3>
<pre><code data-trim class="hljs">
class Auto {
wheels?: number
doors?: number
// ...
constructor(init: Partial&lt;Auto&gt;) {
Object.assign(this, init)
}
}
const a = new Auto({
doors: 5,
})
</code></pre>
</section>
<section>
<h3>Advanced Stuff</h3>
<pre><code data-trim class="hljs">