Skip to content

Class name is missing in Function when es6 target is set #5386

Closed
@pleerock

Description

@pleerock

I have decorator:

export function Document() {
   return function(objectConstructor: Function) {
        console.log(objectConstructor.name); // when targeting es5 it gives me what I want - the name of my class. When targeting es6 it does not give anything
    }
}

Here is decorator usage:

@Document()
export class User {
}

Im using "User" class name to create a document called "User", I need information how class is called. I always used es5, but now when I switched to es6 compile target I dont have information about class name anymore. Is it a bug, or it by design? If second then what is the way to get the class name?

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptES6Relates to the ES6 Spec

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions