title: TypeScript class decorators - add class method
body: <p>How to define property with TypeScript and decorators?</p>
  
  <p>For example I have this class decorator:</p>
  
  <pre><code>function Entity&lt;TFunction extends Function&gt;(target: TFunction): TFunction {
      Object.defineProperty(target.prototype, 'test', {
          value: function() {
              console.log('test call');
              return 'test result';
          }
      });
      return target;
  }
  </code></pre>
  
  <p>And use it:</p>
  
  <pre><code>@Entity
  class Project {
      //
  }
  
  let project = new Project();
  console.log(project.test());
  </code></pre>
  
  <p>I have this console log:</p>
  
  <pre><code>test call            entity.ts:5
  test result          entity.ts:18
  </code></pre>
  
  <p>This code correctly worked, but tsc return error:</p>
  
  <pre><code>entity.ts(18,21): error TS2339: Property 'test' does not exist on type 'Project'.
  </code></pre>
  
  <p>How to fix this error?</p>