Skip to content

unreachable code detection for switch cases out of range of string literal types #6149

Closed
@zpdDG4gta8XKpMCd

Description

@zpdDG4gta8XKpMCd
type foo = 'hey' | 'nay';

switch (<foo>undefined) {
    case 'boom': console.log('never the case'); break; // expected unreachable code, actual no problem
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: Literal TypesUnit types including string literal types, numeric literal types, Boolean literals, null, undefinedFixedA PR has been merged for this issueSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions