Skip to content

[Transforms] Incorrect emit comment after arrow function in Object Literal property assingment #8209

@yuit

Description

@yuit
let impl: I = {
    a: 12,
    explicitVoid2: () => this.a, // ok, this: any because it refers to some outer object (window?)
    explicitVoid1() { return 12; },
    explicitStructural() {
        return this.a;
    },
    explicitInterface() {
        return this.a;
    },
    explicitThis() {
        return this.a;
    },
}

Expected

var impl = {
    a: 12,
    explicitVoid2: function () { return _this.a; },
    explicitVoid1: function () { return 12; },
    explicitStructural: function () {
        return this.a;
    },
    explicitInterface: function () {
        return this.a;
    },
    explicitThis: function () {
        return this.a;
    }
};

Actual

var impl = {
    a: 12,
    explicitVoid2: function () { return _this.a; },
    explicitVoid1: // ok, this: any because it refers to some outer object (window?)
    function () { return 12; },
    explicitStructural: function () {
        return this.a;
    },
    explicitInterface: function () {
        return this.a;
    },
    explicitThis: function () {
        return this.a;
    }
};
  • thisTypeInFunctions
  • decoratorOnClass2

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: TransformsRelates to the public transform APIFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions