title: Typescript: how to use a method decorator in an instance member property (mixin)?
body: <p><strong>Background</strong></p>
  <p>We have implemented a mixin like this (simplified):</p>
  <pre class="lang-js prettyprint-override"><code>export type Constructor&lt;I&gt; = new (...args: any[]) =&gt; I;
  
  export interface IBaseService&lt;T = any&gt; {
    create: (data: any) =&gt; Promise&lt;T&gt;;
  }
  
  export function BaseService&lt;T&gt;(entity: Constructor&lt;T&gt;): Type&lt;IBaseService&lt;T&gt;&gt; {
    class BaseServiceHost implements IBaseService&lt;T&gt; {
      public repository: Repository&lt;T&gt;;
  
      create(data: DeepPartial&lt;T&gt;): Promise&lt;T&gt; {
        const newResource = this.repository.create(data);
        return this.repository.save(newResource);
      }
  
    }
    return BaseServiceHost;
  }
  
  </code></pre>
  <p>Now my service extends <code>BaseService</code> like this:</p>
  <pre class="lang-js prettyprint-override"><code>@Injectable()
  export class ResponseService extends BaseService(ResponseEntity) {
    private readonly respondentService: RespondentService;
    private readonly surveyService: SurveyService;
  
    create = async (data: ResponseInput): Promise&lt;ResponseEntity&gt; =&gt; {
      const respondent = await this.respondentService.findByNaturalKey(data.respondentKey);
      const survey = await this.surveyService.findById(data.surveyId);
      return super.create({ respondent, survey, ...data })
    };
  </code></pre>
  <p>... and this works fine.</p>
  <p>PS.: <code>create</code> has to be a property now, otherwise I'd get the following error:</p>
  <pre class="lang-none prettyprint-override"><code>Class 'IBaseTenantService&lt;ResponseEntity&gt;' defines instance member property 'create',
  but extended class 'ResponseService' defines it as instance member function.
  </code></pre>
  <p><strong>Problem</strong></p>
  <p>The <code>create</code> method (now a property), needs the method decorator <code>Transactional()</code>,
  but the construction</p>
  <pre class="lang-js prettyprint-override"><code>  @Transactional()  // &lt;--- error here
    create = async (data: ResponseInput): Promise&lt;ResponseEntity&gt; =&gt; {
      const respondent = await this.respondentService.findByNaturalKey(data.respondentKey);
      const survey = await this.surveyService.findById(data.surveyId);
      return super.create({ respondent, survey, ...data })
    };
  </code></pre>
  <p>gives the following error:</p>
  <pre class="lang-none prettyprint-override"><code>The return type of a property decorator function must be either 'void' or 'any'.
    Unable to resolve signature of property decorator when called as an expression.
  </code></pre>
  <p><strong>Question</strong></p>
  <p>How to use the <code>Transactional()</code> in the <code>create</code> property? Workarounds?</p>