Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running simple TypeScript crashes Deno #27710

Open
garethj2 opened this issue Jan 17, 2025 · 3 comments
Open

Running simple TypeScript crashes Deno #27710

garethj2 opened this issue Jan 17, 2025 · 3 comments
Labels
bug Something isn't working correctly swc related to swc (bundling/transpiling) upstream Changes in upstream are required to solve these issues

Comments

@garethj2
Copy link

Version: Deno 2.1.5

I upgraded to Deno 2.1.5 and found the Deno process immediately crashes when running my TypeScript. I've boiled down the code to a reproducible test case here.

Here's the resultant error...

./run.sh: line 2: 61461 Trace/BPT trap: 5       deno run ./core/src/main.ts

System

  • Macbook Pro M2
  • 16 GB of RAM
  • macOS Sequoia

Considering the code is so very minor, I find this extremely worrying that it completely crashes the process outright.

@0f-0b
Copy link
Contributor

0f-0b commented Jan 17, 2025

This might be the same bug as #25192.

@nathanwhit nathanwhit added bug Something isn't working correctly upstream Changes in upstream are required to solve these issues swc related to swc (bundling/transpiling) labels Jan 17, 2025
@nathanwhit
Copy link
Member

Confirmed this is a bug in SWC, likely the same as #27399

Running with a debug build yields:

thread 'tokio-runtime-worker' panicked at /home/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc_ecma_visit-0.104.8/src/lib.rs:552:9:
internal error: entered unreachable code: This visitor does not support TypeScript. This method fails for optimization purposes. Encountered in unreachable visitor: visit_mut_ts_type
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@rracariu
Copy link

rracariu commented Jan 17, 2025

Managed to reduce this and looks that the cause is this line:

constructor(test: unknown) {
    this.#test = test as string; // <- this cast is what causes the crash :(
}

Removing the cast or using the string type directly will allow this to function correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly swc related to swc (bundling/transpiling) upstream Changes in upstream are required to solve these issues
Projects
None yet
Development

No branches or pull requests

4 participants