title: Decorators syntax in typescript
body: <p>I don't understand most things about the next code (it's from the typescript handbook):</p>
  <pre><code>function classDecorator&lt;T extends { new (...args: any[]): {} }&gt;(
    constructor: T
  ) {
    return class extends constructor {
      newProperty = &quot;new property&quot;;
      hello = &quot;override&quot;;
    };
  }
  
  @classDecorator
  class Greeter {
    property = &quot;property&quot;;
    hello: string;
    constructor(m: string) {
      this.hello = m;
    }
  }
  
  console.log(new Greeter(&quot;world&quot;));
  </code></pre>
  <p>Why in <code>&lt;T extends { new (...args: any[]): {} }&gt;</code>, <code>T</code> extends an &quot;object¿?&quot;? What is exactly what T is extending?</p>
  <p>And why that function is returning a class that extends the constructor? I'm very confused and I have trying to understand that 2 days. Thanks.</p>