Skip to content

ES6 class decoration output means property, method & parameter decorations can not get type information from target #6293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jamcoupe opened this issue Dec 30, 2015 · 1 comment
Labels
Duplicate An existing issue was already created

Comments

@jamcoupe
Copy link

function Decoration() {}
function PropertyDecoration(target: any) {
  console.log(target);
}

@Decoration
export class ClassName {

  @PropertyDecoration
  property: string = 'null';
}

compiles to:

function Decoration() { }
function PropertyDecoration(target) {
    console.log(target);
}
let ClassName = class {
    constructor() {
        this.property = 'null';
    }
};

However this means that the console.log result will be {}. Removing the @Decoration class decorator outputs:

function PropertyDecoration(target) {
    console.log(target);
}
class ClassName {
    constructor() {
        this.property = 'null';
    }
}

with the better console.log result of ClassName {}.

@jamcoupe jamcoupe changed the title ES6 Class decoration output issue ES6 class decoration output means property, method & parameter decorations can not get type information from target Dec 31, 2015
@mhegazy
Copy link
Contributor

mhegazy commented Jan 5, 2016

looks like a duplicate of #6132

@mhegazy mhegazy closed this as completed Jan 5, 2016
@mhegazy mhegazy added the Duplicate An existing issue was already created label Jan 5, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants