<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="function Decoration() {}
function PropertyDecoration(target: any) {
  console.log(target);
}

@Decoration
export class ClassName {

  @PropertyDecoration
  property: string = 'null';
}
"><pre class="notranslate"><code class="notranslate">function Decoration() {}
function PropertyDecoration(target: any) {
  console.log(target);
}

@Decoration
export class ClassName {

  @PropertyDecoration
  property: string = 'null';
}

</code></pre></div>
<p dir="auto">compiles to:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="function Decoration() { }
function PropertyDecoration(target) {
    console.log(target);
}
let ClassName = class {
    constructor() {
        this.property = 'null';
    }
};"><pre class="notranslate"><code class="notranslate">function Decoration() { }
function PropertyDecoration(target) {
    console.log(target);
}
let ClassName = class {
    constructor() {
        this.property = 'null';
    }
};
</code></pre></div>
<p dir="auto">However this means that the console.log result will be <code class="notranslate">{}</code>. Removing the <code class="notranslate">@Decoration</code> class decorator outputs:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="function PropertyDecoration(target) {
    console.log(target);
}
class ClassName {
    constructor() {
        this.property = 'null';
    }
}"><pre class="notranslate"><code class="notranslate">function PropertyDecoration(target) {
    console.log(target);
}
class ClassName {
    constructor() {
        this.property = 'null';
    }
}
</code></pre></div>
<p dir="auto">with the better console.log result of <code class="notranslate">ClassName {}</code>.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="const bar = (target: any, name: any, value: any) =&gt; {
  const parentName = target.constructor.name
  console.log(parentName)
}
class a {
  @bar
  public foo() {
  }
}"><pre class="notranslate"><code class="notranslate">const bar = (target: any, name: any, value: any) =&gt; {
  const parentName = target.constructor.name
  console.log(parentName)
}
class a {
  @bar
  public foo() {
  }
}
</code></pre></div>
<p dir="auto">It works. <em>But</em></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="const bar = (target: any, name: any, value: any) =&gt; {
  const parentName = target.constructor.name
  console.log(parentName)
 // it would be an empty string here!!!!!!!!
}
const log = (target: any) =&gt; {}

@log
class a {
  @bar
  public foo() {
  }
}"><pre class="notranslate"><code class="notranslate">const bar = (target: any, name: any, value: any) =&gt; {
  const parentName = target.constructor.name
  console.log(parentName)
 // it would be an empty string here!!!!!!!!
}
const log = (target: any) =&gt; {}

@log
class a {
  @bar
  public foo() {
  }
}
</code></pre></div>
<p dir="auto">these code is ok when compile target was <code class="notranslate">ES5</code>, but missing class name when target was <code class="notranslate">ES6</code></p>