Microsoft/TypeScript

`tsc` loses the class name in sourcemap

Open

#55.912 geöffnet am 29. Sept. 2023

Auf GitHub ansehen
 (0 Kommentare) (4 Reaktionen) (0 zugewiesene Personen)TypeScript (6.726 Forks)batch import
Domain: Source MapsHelp WantedPossible Improvement

Repository-Metriken

Stars
 (48.455 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (9 gemergte PRs in 30 T)

Beschreibung

🔎 Search Terms

  • stack trace
  • lose class name

🕗 Version & Regression Information

Now I use TypeScript v5.2.2. This is not a critical bug, so I did not pay attention when it appeared.

💻 Code

// tmp.ts
class MyClass {
  static staticMethod() {
    throw new Error('Error in static method');
  }
}

MyClass.staticMethod();

Enable sourceMap in tsconfig, compile this code with tsc and then run compiled file with --enable-source-maps option:

tsc tmp.ts
node --enable-source-maps dist/tmp.js

🙁 Actual behavior

Error: Error in static method
    at Function.staticMethod

As you can see, the class name is missing from the stack trace. This bug appears only when the error occurs in static methods.

🙂 Expected behavior

Error: Error in static method
    at MyClass.staticMethod

Contributor Guide