Skip to content

tsgo does not detect unreachable code #941

@Kumneger0

Description

@Kumneger0

Reproduction Steps

  1. Follow the setup instructions from this blog post to enable tsgo in VSCode(if you haven't already):
    https://devblogs.microsoft.com/typescript/announcing-typescript-native-previews/

  2. Create a .ts file and add the following code:

    function doSomethingAwesome() {
      throw new Error("we messed up");
      return [];
    }

Expected Behavior

The return statement should be reported as unreachable when it follows a throw

Actual Behavior

No unreachable code warning is shown.

Environment

  • @typescript/native-preview version: 7.0.0-dev.20250525.1
  • Node.js version: v20.18.2
  • OS: Ubuntu 24.04 (if applicable)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions