Skip to content

Missing error for initializing shadowed var in a binding pattern #2351

@JsonFreeman

Description

@JsonFreeman

These should all be errors, but only the ones where x is initialized directly give errors:

if (true) {
    let x;
    if (true) {
        var x = 0; // Error
        var { x = 0 } = { x: 0 }; // Error
        var { x: x = 0 } = { x: 0 }; // Error
        var { x } = { x: 0 }; // No error, even though the let x is being initialized
        var { x: x } = { x: 0 }; // No error, even though the let x is being initialized
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions