Reputation: 4552
I am considering to convert my current js codebase to use TypeScript in NodeJS.
One thing that concern me is that if error occurs on a request, I can see the stacktrace in AWS CloudWatch (request log) to understand the exact code line that cause the problem.
If I use typescript, I suppose the log can still point me to the crash line from the transpiled js file. But I wonder if its possible to give me callstack to the ts file instead, which is more natural to me as I wrote ts instead of the js file.
Thanks
Upvotes: 3
Views: 1826
Reputation: 1395
You can also use https://github.com/TypeStrong/ts-node which will transpile and execute your typescript code transparently, and will point to the original typescript files in stacktraces.
Upvotes: 0
Reputation: 10607
TypeScript can generate source maps. Then it is simply a question of telling nodejs to use source maps in stack traces, like so for example.
Upvotes: 2