<p dir="auto">Hi, I'm using TSC 1.5.3 (latest head) and I'm trying to compile following piece of code</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@SomeDecorator()
export class App {
  constructor() {
  }
}"><pre class="notranslate">@<span class="pl-smi">SomeDecorator</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
<span class="pl-k">export</span> <span class="pl-k">class</span> <span class="pl-smi">App</span> <span class="pl-kos">{</span>
  <span class="pl-en">constructor</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>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{&quot;compilerOptions&quot;: {
    &quot;emitDecoratorMetadata&quot;: true,
    &quot;experimentalDecorators&quot;: true,
    &quot;module&quot;: &quot;system&quot;,
    &quot;target&quot;: &quot;es5&quot;
}}"><pre class="notranslate">{<span class="pl-ent">"compilerOptions"</span>: {
    <span class="pl-ent">"emitDecoratorMetadata"</span>: <span class="pl-c1">true</span>,
    <span class="pl-ent">"experimentalDecorators"</span>: <span class="pl-c1">true</span>,
    <span class="pl-ent">"module"</span>: <span class="pl-s"><span class="pl-pds">"</span>system<span class="pl-pds">"</span></span>,
    <span class="pl-ent">"target"</span>: <span class="pl-s"><span class="pl-pds">"</span>es5<span class="pl-pds">"</span></span>
}}</pre></div>
<p dir="auto">which will then produce following code</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var __decorate = ...;
var __metadata = ...;
System.register([], function(exports_1) { ... };"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">__decorate</span> <span class="pl-c1">=</span> ...<span class="pl-kos">;</span>
<span class="pl-k">var</span> <span class="pl-s1">__metadata</span> <span class="pl-c1">=</span> ...<span class="pl-kos">;</span>
<span class="pl-v">System</span><span class="pl-kos">.</span><span class="pl-en">register</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">function</span><span class="pl-kos">(</span><span class="pl-s1">exports_1</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">Now this doesn't really play nice together with systemjs and it works for me only when manually moving the <code class="notranslate">var __decorate</code> and <code class="notranslate">var __metadata</code> declarations into the anonymous function <code class="notranslate">function(exports_1) { ..here... }</code>.  Not sure if it's really valid to have these variable declarations outside of the <code class="notranslate">System.register</code>.</p>
<p dir="auto">Original issue: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="81047305" data-permission-text="Title is private" data-url="https://github.com/systemjs/builder/issues/178" data-hovercard-type="issue" data-hovercard-url="/systemjs/builder/issues/178/hovercard" href="https://github.com/systemjs/builder/issues/178">systemjs/builder#178</a></p>