Skip to content

Wrong behavior when translate Class to ES5 #16480

Closed
@Jack-Works

Description

@Jack-Works

TypeScript Version: 2.3.4
Code

class N {
    q() {}
}
let x = new N().q.name

Expected behavior:
x should be "q"
Actual behavior:
x is ""

Problem

var N = (function () {
    function N() {
    }
    N.prototype.q = function () { };
    //  ↑ should be N.proptotype.q = function q() {};
    return N;
}());

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions