Skip to content

Suggestion: errors based on control flow analysis #2176

Closed
@rolyp

Description

@rolyp

What, all this business with union types, indeed a veritable managerie of type-related tricks, and we can't make the basics work?

function borked(): number {
    if (false)
        return 1;
}

I know this will be flagged with the dreaded "By Design", because of some silly JavaScript use case that I can't imagine, but it's such an obviously wrong feature of the language that I can't help raising as an issue. (Apologies if it's a duplicate.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedA PR has been merged for this issueSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions