Skip to content

Incorrect emit for a property assignment referencing a renamed let #2350

@JsonFreeman

Description

@JsonFreeman
var x;
if (true) {
    let x;
    var obj1 = { x: x }; // Should be { x: _x }, emits as { _x: _x }
    var obj2 = { x }; // Should be { x: _x }, emits as { _x: x }
}

The problem is that we are doing this rename in emitIdentifier, and we are not being picky enough about where we rename. Property names should never be renamed, and identifier references should always be renamed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions