<p dir="auto"><strong>TypeScript Version:</strong> 1.8.10</p>
<p dir="auto"><strong>Code</strong></p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="export default new class Foo {
  @someDecorator
  someMethod() {}
}"><pre class="notranslate"><span class="pl-k">export</span> <span class="pl-k">default</span> <span class="pl-k">new</span> <span class="pl-k">class</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span>
  @<span class="pl-s1">someDecorator</span>
  <span class="pl-en">someMethod</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>
<p dir="auto">Will result in an error on <code class="notranslate">@someDecorator</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="error TS1206: Decorators are not valid here."><pre class="notranslate"><code class="notranslate">error TS1206: Decorators are not valid here.
</code></pre></div>
<hr>
<p dir="auto">It can be worked around via</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Foo {
  @someDecorator
  someMethod() {}
}
export default new Foo();"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span>
  @<span class="pl-s1">someDecorator</span>
  <span class="pl-en">someMethod</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-k">export</span> <span class="pl-k">default</span> <span class="pl-k">new</span> <span class="pl-smi">Foo</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">Not sure if this is by design or not, but the following gives a compile error of "Decorators are not valid here" with TypeScript 1.8:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="let testClass = new class {
    testMethod(@myDecorator date: Date): any {
        return date;
    }
}();"><pre class="notranslate"><span class="pl-k">let</span> <span class="pl-s1">testClass</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-k">class</span> <span class="pl-kos">{</span>
    <span class="pl-en">testMethod</span><span class="pl-kos">(</span>@<span class="pl-s1">myDecorator</span> <span class="pl-s1">date</span>: <span class="pl-smi">Date</span><span class="pl-kos">)</span>: <span class="pl-smi">any</span> <span class="pl-kos">{</span>
        <span class="pl-k">return</span> <span class="pl-s1">date</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>