Skip to content

Downlevel for 'let' doesn't account for nested declarations #2449

Closed
@JsonFreeman

Description

@JsonFreeman
var x;
function foo() {
    let x = 0;
    (function () {
        var _x = 1;
        console.log(x); // Prints 1, should print 0
    })();
}

The rename of the 'let' does not account for the _x declared in the nested function. Consequently, it chooses _x as the rename, but now the inner _x shadows it.

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