typescript-go icon indicating copy to clipboard operation
typescript-go copied to clipboard

tsgo does not detect unreachable code

Open Kumneger0 opened this issue 7 months ago • 2 comments

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)

Kumneger0 avatar May 26 '25 18:05 Kumneger0