M
M
Maxim Ivanov2017-01-16 11:50:48
Google Chrome
Maxim Ivanov, 2017-01-16 11:50:48

How to get stack trace for TypeScript code map?

Wrote a simple logger for debugging (in production and dev environment). But it turned out to be inconvenient when, when called from .ts files, the
debugger shows that it was called from a class file, which is not correct.
b24c2e621c854bda88a124381d68eb13.png
Although I wrote in the component file (app.component.ts):

ngOnInit() {
 log.debug("Init component");
}

I was expecting to see in the debugger a reference to the app.component.ts line number, but I got everything from logger.ts, what should I do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Ivanov, 2017-01-19
@splincodewd

The result is a hack, but there are alternatives that are almost the same
https://www.npmjs.com/package/ts-debugger
Tested on webpack2 + typescript2 + angular2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question