Skip to content

Missing class name when use decorator #6132

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
Brooooooklyn opened this issue Dec 17, 2015 · 1 comment
Closed

Missing class name when use decorator #6132

Brooooooklyn opened this issue Dec 17, 2015 · 1 comment
Assignees
Labels
Bug A bug in TypeScript Duplicate An existing issue was already created

Comments

@Brooooooklyn
Copy link

const bar = (target: any, name: any, value: any) => {
  const parentName = target.constructor.name
  console.log(parentName)
}
class a {
  @bar
  public foo() {
  }
}

It works. But

const bar = (target: any, name: any, value: any) => {
  const parentName = target.constructor.name
  console.log(parentName)
 // it would be an empty string here!!!!!!!!
}
const log = (target: any) => {}

@log
class a {
  @bar
  public foo() {
  }
}

these code is ok when compile target was ES5, but missing class name when target was ES6

@mhegazy
Copy link
Contributor

mhegazy commented Jan 7, 2016

duplicate of #5386

@mhegazy mhegazy closed this as completed Jan 7, 2016
@mhegazy mhegazy added the Duplicate An existing issue was already created label Jan 7, 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
Bug A bug in TypeScript Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants