Skip to content

Use-before-def is reported incorrectly for switch statement expressions #2280

Description

@DanielRosenwasser
var x = 10;

switch (x) {
    case 10:
        let x = 20;
}

It is worth ensuring the spec behavior, but I was under the impression that the x in switch (x) would refer to the outer x. Instead, we get

Block-scoped variable 'x' used before its declaration.

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